Let $L$ be the distance between $(x,y)$ on the curve $x^2+2y=0$ and $(0,-1/2)$. Then $L^2=x^2+(y+\frac{1}{2})^2=-2y+(y+\frac{1}{2})^2$, $\frac{dL^2}{dy}=-2+2(y+\frac{1}{2})=0$, which gives $y=1/2$.
But this is clearly incorrect. $y=1/2$ does not even lie on the curve!
I know that if we express $y$ in terms of $x$, and then differentiate over $x$, we can get the correct answer $(0,0)$.
But I don't figure out what's wrong when we differentiate over $y$.
Interesting puzzle.
If you draw a picture you'll see the problem. Both the picture and the algebra tell you that $y$ must be nonpositive.
Now think more carefully about how you find the minimum of a differentiable function. That can occur at a root of the derivative or at an end point of the domain.
In this case the minumum is at $0$; the distance increases as $|y|$ increases along the negative $y$-axis.