Divergence-free vector field on a non-simply connected domain We know that divergence-free vector fields are themselves curls of vector fields on simply connected domains. I want to construct a counterexample in the case the domain is not simply connected. So consider an infinite line of charge along the $z$-axis of constant charge density. Then its electric field is given (unless I have made a mistake) by $$\vec{E} = k\left\langle\frac{x}{x^2+y^2}, \frac{y}{x^2+ y^2},0 \right\rangle.$$ By Gauss' theorem this should be divergence free (also follows from a simple computation). Can it be shown that this is not the curl of some vector field? 
I guess in general if we can find a surface without boundary on which the flux is not zero then by Stokes' theorem the electric field cannot be the curl of a vector potential. But the problem is that there cannot find a closed surface without boundary around the $z$-axis, and so maybe one has to take the unit sphere and remove a small cylinder and use some approximation argument. Any ideas?
 A: *

*We remove an overall constant for simplicity. Let us use cylindrical coordinates $(\rho,\phi,z)$, where
$$\tag{1} x ~=~\rho \cos\phi, \qquad y ~=~\rho \sin\phi .$$
Also assume the standard metric
$$\tag{2} ds^2~=~\mathrm{d}x\odot \mathrm{d}x
+\mathrm{d}y\odot \mathrm{d}y
+\mathrm{d}z\odot \mathrm{d}z
~=~\mathrm{d}\rho\odot \mathrm{d}\rho
+\rho^2\mathrm{d}\phi\odot \mathrm{d}\phi
+\mathrm{d}z\odot \mathrm{d}z.\qquad$$

*Let us first consider the full space $\mathbb{R}^3$. In 3 spatial dimensions, we can dualize OP's vector field 
$$\tag{3} \vec{E} ~=~\frac{x}{\rho^2}\frac{\partial }{\partial x}+\frac{y}{\rho^2}\frac{\partial }{\partial y}~=~\frac{1}{\rho}\frac{\partial }{\partial \rho}, $$
as a two-form
$$\tag{4} \mathbb{E} ~=~ \eta \wedge\mathrm{d}z , \qquad 
\eta~:=~\frac{x\mathrm{d}y-y\mathrm{d}x}{\rho^2}\qquad\left(=\mathrm{d}\phi\right).   $$
(The vector field (3) is not defined on the $z$-axis, a Lebesgue measure zero set.)

*The divergence is
$$\tag{5}\vec{\nabla}\cdot \vec{E}~=~2\pi\delta(x)\delta(y), $$
cf. Gauss law; or equivalently in the dual language,
$$ \mathrm{d}\mathbb{E} ~=~\mathrm{d} \eta \wedge\mathrm{d}z
~=~2\pi\delta(x)\delta(y) \mathrm{d}x\wedge \mathrm{d}y\wedge\mathrm{d}z,$$ 
$$\tag{6} \mathrm{d} \eta ~=~2\pi\delta(x)\delta(y)\mathrm{d}x\wedge \mathrm{d}y,$$
which has support on the $z$-axis.

*If we define one-form 
$$\tag{7}A~:=~z\eta,$$
we can use the metric (2) to get a vector field
$$\tag{8}\vec{A}~=~\frac{z}{\rho^2} \left(y\frac{\partial }{\partial x}
-x \frac{\partial }{\partial y}\right)\qquad\left(=\frac{z}{\rho^2} \frac{\partial }{\partial \phi}\right).  $$

*Then
$$\tag{9}\mathrm{d}A+\mathbb{E}~=~z\mathrm{d} \eta, $$
or equivalently, in terms of vector fields,
$$\tag{10}\vec{\nabla}\times \vec{A}-\vec{E}~=~-2\pi z\delta(x)\delta(y)\frac{\partial }{\partial z},$$

*If we think of the vector field (3) as a magnetic field, then the $z$-axis is a 1-dimensional collection of Dirac magnetic monopoles, and the rhs. of eq. (10) is an accumulation of corresponding Dirac strings.

*Finally, if we restrict to the space $\left(\mathbb{R}^2\backslash\{(0,0)\}\right) \times \mathbb{R} $ without the $z$-axis, then eq. (10) shows that OP's vector field $\vec{E}$ can be written as a curl of a vector field $\vec{A}$.
A: I doubt that your expression is correct. Your original equation is of the
form
\begin{equation*}
\partial _{\mathbf{x}}\cdot \mathbf{E(x})=\rho (\mathbf{x})
\end{equation*}
where $\rho (\mathbf{x})$ vanishes away from the $x_{3}$-axis.  You can write
\begin{equation*}
\mathbf{E(x})=\mathbf{E}_{1}\mathbf{(x})+\mathbf{E}_{2}\mathbf{(x})=\partial
_{\mathbf{x}}\Phi (\mathbf{x)+}\partial _{\mathbf{x}}\times \mathbf{A}(
\mathbf{x})
\end{equation*}
Then
\begin{equation*}
\partial _{\mathbf{x}}^{2}\Phi (\mathbf{x)}=\rho (\mathbf{x})
\end{equation*}
which results in
\begin{equation*}
\Phi (\mathbf{x})=-\int d\mathbf{y}\frac{1}{|\mathbf{x-y}|}\rho (\mathbf{y})
\end{equation*}
which need not vanish outside the  $x_{3}$-axis.
