You can't, because in general this is false.
Lets look for example at the following vector field
$$\vec{F}=\left(-\frac{y}{x^{2}+y^{2}},\frac{x}{x^{2}+y^{2}},0\right) \tag{1}$$
that is defined on $\mathbb{R}^{3}\setminus\{\left(0,0,0\right)\}$. It is easy to see that
$$\vec{\nabla}\times\vec{F}=\begin{vmatrix}\hat{x}&\hat{y}&\hat{z}\\\partial_{x}&\partial_{y}&\partial_{z}\\-\frac{y}{x^{2}+y^{2}}&\frac{x}{x^{2}+y^{2}}&0\end{vmatrix}=\hat{z}\left(\partial_{x}\frac{x}{x^{2}+y^{2}}+\partial_{y}\frac{y}{x^{2}+y^{2}}\right)=\hat{z}\left(\frac{x^{2}+y^{2}-2x^{2}}{\left(x^{2}+y^{2}\right)^{2}}+\frac{x^{2}+y^{2}-2y^{2}}{\left(x^{2}+y^{2}\right)^{2}}\right)=\vec{0} \tag{2}$$
So you might think that there exists a potential function $V$ such that $\vec{F}=-\vec{\nabla}V$, but this would imply that
$$\int_{C}\vec{F}\cdot\vec{{\rm d}\ell}=0 \tag{3}$$
for every closed curve $C$. If we choose $C$ to be the unit circle in the $\rm XY$ plane, namely
$$\left(x,y,z\right)=\left(\cos\theta,\sin\theta,0\right),\:\: \theta\in\left[0,2\pi\right) \tag{4}$$
then
$$\int_{C}\vec{F}\cdot\vec{{\rm d}\ell}=\int_{C}\left(-\frac{y{\rm d}x}{x^{2}+y^{2}}+\frac{x{\rm d}y}{x^{2}+y^{2}}\right)=\int_{0}^{2\pi}\left(\frac{\sin^{2}\theta}{\cos^{2}\theta+\sin^2\theta}+\frac{\cos^{2}\theta}{\cos^{2}\theta+\sin^2\theta}\right){\rm d}\theta=2\pi\tag{5}$$
which clearly contradicts Eq. $3$, and therefore a potential function does not exist. This fact is related to objects known as differential forms. The vector field in Eq. $1$ corresponds to the differential form
$$\omega=-\frac{y}{x^{2}+y^{2}}{\rm d}x+\frac{x}{x^{2}+y^{2}}{\rm d}y \tag{6}$$
and the fact that $\vec{F}$ is curl-free (Eq. $2$) is equivalent to saying that the exterior derivative of the form vanishes
$${\rm d}\omega=0 \tag{7}$$
Such a form that satisfies Eq. $7$ is called closed form. The existence of potential, in the jargon of differential forms, is written as
$$\omega={\rm d}\alpha\tag{8}$$
and one then refers to $\omega$ as an exact form. It is always true that an exact form is closed, but the opposite is false as you've seen above. Nevertheless, if one assumes that the domain in question is a star domain
(note that one may require an alternative condition), then the statement is iff. In the example we studied the domain is $\mathbb{R}^{3}\setminus\{\left(0,0,0\right)\}$, and it is obiously not a star domain.