This is just an elaboration of Anthony Carapetis's answer.
Lemma:
Let $g : \mathbb R^n \to \mathbb R$ be a $C^1$ function satisfying $g(x) \ne 0 \implies dg(x) = 0$. Then $g$ is constant.
Proof:
Suppose that $g$ is not constant, then there exist $x=(x_1,\dots,x_n) \in \mathbb{R}^n$ such that $dg(x) \neq 0$. Thus, there exist a direction $e_i$ such that $\frac{\partial g}{\partial x_i}(x) \ne 0$.
Denote by $f:\mathbb{R} \to \mathbb{R}$ the function $f(s)=g(x_1,\dots,x_{i-1},s,x_{i+1},\dots,x_n)$.
$f \in C^1$, and $f'(x_i)=\frac{\partial g}{\partial x_i}(x) \neq 0$. Thus, by continuity $f'$ has a constant sign on some interval $[x_i -\epsilon , x_i+\epsilon]$.
So, $f$ is strictly monotone on $[x_i -\epsilon , x_i+\epsilon]$, so the image $g([x -\epsilon e_i, x+\epsilon e_i])$ contains an open interval, which we can assume W.L.O.G that does not contain zero. But we also know that $dg \neq 0$ on $[x -\epsilon e_i, x+\epsilon e_i]$, which is a contradiction to the assumption.