Take $R=\mathbb{Z}$ and $P=0$. Then, ${\rm Spec}(R_P)$, considered canonically as a subset of ${\rm Spec}(R)$, consists precisely of the point $0$. In particular, it is not open in ${\rm Spec}(R)$. Hence, it is not a neighbourhood in ${\rm Spec}(R)$ of $0$, despite $0$ being the generic point of ${\rm Spec}(R_P)$ and ${\rm Spec}(R_P)$ being an open neighbourhood of its generic point in itself.
You might want to have a look at Section I.2.5, especially Proposition I.2.5.2, of EGA [1970 edition] (or Section I.2.4 in the first edition) to get some more general information about your situation.