I know the case is false if $S \subset \Bbb R$ by Rolle's Theorem, what is a counter example if $S = \Bbb R$?
I think the "analog" is false on $\Bbb C$, but that's yet to be proven?
Addedeum: Actually it just occurred to me this is false if we weaken the question to non smooth functions; $f = -1/x^2 \implies f' = 2/x^3 \neq 0$. So I am rewording the original question to "constant derivative".
Addedeum2: The case for $\Bbb R$ is fine. Ignore the case for $n > 2$.
If $f'(x) = const$ and $f$ is smooth, then must $f$ be necessarily injective on $dom(f) \subseteq \Bbb R$? We may assume that $dom(f)$ is either an interval (done by Rolle) or all of $\Bbb R$.
If $f$ is defined (and differentiable everywhere it is defined) on an interval or $\mathbb R$, then Rolle's theorem precisely states, that a non-vanishing derivative implies injectivity.
You say, that you have done the interval-case. But if you want to check injectivity, say $f(a) \neq f(b)$ for $a < b$, you can just consider $f_{|[a,b]}$ and you are in the interval case.