To have an inverse $f^{-1}$, a function $f:A\to B$ must be:
One to one - meaning that if $f(a) = f(b)$, then $a = b$. This is also known as being "injective". This can also be characterized as $f$ takes each point in $A$ to a unique point in $B$.
Onto - meaning that $f$ "hits" every point in $B$, or that given $b\in B$, that there exists $a\in A$ such that $f(a) = b$.
Here, "Onto" isn't even that important, because if $f$ is one-to-one and not onto, it has to be onto for a subset of $B$.
The issue is that $f(x) = 0$ for all $x$ is very much not injective. We can try building an inverse by looking at what are known as preimages or fibers. So, let's pretend like we found an inverse $f^{-1}$. Now for a tricky question: what is $f^{-1}(0)$ equal to?
Well, we known that $f(0) = 0$, so we should have that $f^{-1}(0) = 0$. We also know that $f(1) = 0$, so we should have that $f^{-1}(0) = 1$ as well. Uh oh. It turns out that $f^{-1}(0) = A$, so the preimage of $0$ isn't just a single point (which would let us make a well-defined function), but is every single point in our domain. So, any inverse function would be required to send $0$ to every point in our domain simultaneously, which isn't allowed in functions (for a function to be well defined, it must take each input to a single output).