Let f be a vector field as follows. Note that f is defined everywhere except the origin.
x ← -y over (x2+y2) y ← x over (x2+y2)
The mixed partials are equal, namely (y2-x2) over (x2+y2)2. Let a path trace the unit circle. In other words, x = cose(t) and y = sin(t). The line integral simplifies to sine2+cosine2, or 1. Integrate 1 from 0 to 2π and get 2π. This isn't 0, hence f is not conservative.
The problem is the origin. We can't slide one semicircle over to the other, continuously, without crashing into the origin, where f is not defined. If we could, the two line integrals around the two half circles would be the same, giving path independence. Here's why.
Let two paths connect a and b, forming a closed curve. Let f be defined throughout the entire region bounded by the closed curve and assume the mixed partials are equal. Now apply green's theorem. The double integral is 0, hence the line integral around the closed curve is also 0. The two paths from a to b give the same line integral, and we have path independence, and a conservative field.
If f is defined on a simply connected region, with no holes or singularities, and f has equal mixed partials, it is conservative, and is the gradient of something else. Draw any two paths from a to b and note that f is defined throughout the region enclosed by these paths. Argue as above to show path independence, hence a conservative field.
It's interesting to see how a singularity at the origin can really mess things up. In our earlier example, a path from 0,-1 to 0,1 gives a line integral of ±π. The path could snake all over the plane, but the value of its line integral depends only on whether the path passes the origin on the right or the left. The path could be miles long, but move a tiny piece of it just a pinch, so that it crosses the x axis on the other side of the origin, and the line integral jumps from π to -π. Very strange indeed.
If we define the region as the entire plane except for the negative x axis, our field becomes conservative again. Mixed partials are equal and the region is simply connected. We can't draw a loop around the origin any more, hence green's theorem always applies. The vector function is the gradient of something else, namely atan(y/x). The line integral from 0 to any point in the plane is the angle determined by that point. Angles run from -π to π, continuously. There is no discontinuity where -π meets π, because the negative x axis is out of bounds.