I know this is pretty basic, but I was never happy enough with separation of variables because of this it, so I decided to finally clarify it.
Suppose I have a certain PDE, which for convenience I will choose to be Schrödinger's equation: $$-\frac{\hbar}{2m}\frac{\partial^{2}\psi(x,t)}{\partial x^{2}}+V(x)\psi(x,t) = i\hbar\frac{\partial \psi(x,t)}{\partial t}.$$
When we solve it by separation of variables, we write $\psi(t,x) = X(x)T(t)$ and plug it back into the above equation. This leads: $$-\frac{\hbar}{2m}\frac{X''(x)}{X(x)} + V(x) = i\hbar \frac{T'(t)}{T(t)}. \tag{1}\label{1}$$ Then, we argue that each side of this new equation must be equal to a constant.
My question is: the step (\ref{1}) is really crucial, because it separates the $x$ and $t$ dependent functions. However, what if either $X$ or $T$ takes zero values? I mean, what if $X(x) = 0$ for some $x$? Then (\ref{1}) wouldn't be well-defined, right? And this is usually the case, because in quantum mechanics one usually has zero boundary conditions. Why is (\ref{1}) a correct step or justification to solve a PDE?