If $a\not=b$, the line passing through $a$ and $b$ must contain a point $c$ where the derivative of the restriction $g$ of $f$ to that line parametrised by length along that line is $g'(c)=\frac{g(a)-g(c)}{a-b}$. If $D(f)=0$ everywhere, then $\displaystyle g'(c)$ is always $0$.
For any point $c$ in an open set, points $a$ and $b$ can be chosen in an arbitrarily small neighbourhood of $c$ with the line between then passing through $c$, and since differentiable functions must be continuous, $g(a)=g(b)$ and hence $f(a)=f(b)$ everywhere in $V$.