As Sandor pointed out, a necessary condition is that the prime ideal $P$ is a complete intersection. Here is a proof that it is also sufficient. It will suffice to prove the following:
Claim: Let $(R,m)$ be a Noetherian local ring and $x\in m$ a regular element on $R$. If $R/(x)$ is a domain, then so is $R$.
Proof: Suppose $ab=0$ in $R$. Then modulo $x$, one of them say $a$, must be $0$. So $a=xa_1$, thus $x(a_1b)=0$. As $x$ is regular, $a_1b=0$, and continuing in this fashion one of $a,b$ must be divisible by arbitrary high power of $x$, so it must be equal to $0$.
As for an example which is not a part of a regular s.o.p, take something like $P=(x^2+y^2, u^2+v^2)$ P=(x^2+y^2+z^2, u^2+v^2+w^2)$ in $\mathbb C[[x,y,u,v]]$C[[x,y,z,u,v,w]]$.