We know that divergence free vector fields are themselves curls of vector fields on simply connected domains. I want to construct a counter example 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\langle\frac{x}{x^2+y^2}, \frac{y}{x^2+ y^2},0\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?