Take $A=K[X]$, $B=K[X,Y]/(XY)$ and $\alpha$ the following application $$A=K[X]\subset K[X,Y]\rightarrow K[X,Y]/(XY)=B.$$ Obviously $\alpha$ is injective. Write $B=K[x,y]$ with $xy=0$. Let $Q=xB$. It is obvious that $Q$ is prime ($B/Q\cong K[Y]$) and $P=\alpha^{-1}(Q)=XA$. Now choose $\frac{X}{1}\in A_P$ and observe that $\alpha(\frac{X}{1})=\frac{x}{1}$. But $\frac{x}{1}=\frac{0}{1}$ in $B_Q$ because $yx=0$ and $y\in B-Q$.


Since algebraic geometry is one of the tags, let me give a geometric account of the problem: one is given Spec $B \to $ Spec $A$ dominant, and one wants to show that this isn't necessarily dominant in a n.h. of some point $Q$ of Spec $B$. The basic way to achieve this is to arrange Spec $B$ to be the union of two components, one which maps dominantly to Spec $A$ and one which doesn't, and take $Q$ to be a point lying (only) on the component that doesn't map dominantly. This is what happens in the accepted answer: Spec $B$ is two lines crossing, Spec $A$ is a single line, and the map is the identity on the first line and constant on the second line. The point $Q$ is then taken to be the generic point of the second line.


The question is right,isn't it? Actually,see an exercise (2.18b) of chap.2 of algebraic geometry by Hartshorne.Given a ring homomorphism $f:A \to B$,let $g:SpecB \to SpecA$ be the induced morphism.Then f is injective iff the map of sheaves$g^\sharp:O_{SpecA} \to g_*O_{SpecB}$ is injective.Note that $g^\sharp $ is injective iff for any $ a \in A$,$ g^ \sharp(D(a)):O_{SpecA}(D(a)) \to g_*O_{SpecB}(D(a))$ is injective i.e. for any $ a \in A$,$ g^ \sharp_a:A_a \to B_{f(a)}$ is injective .So the question becomes f is injective iff $g^\sharp_a$ is injective for any $a\in A$.The proof as follows: "if"part,assume $g^\sharp $ is injective,taking global section (note that taking global functor is left exact) we have $f:A \to B $ is injective."only if"part,if $f:A \to B $ is injective ,and $g^\sharp_a(c/a^n)=f(c)/f(a^n)=0 \in B_{f(a)}$,then there exists some intrger $m$ such that $ f(c)f(a)^m=0$ which implies $ f(ca^m)=0 $,since f is injective, $ ca^m=0$, so $c/a^n=0$.Q.E.D.By this conclusion, a ring homomorphism f is injective iff for any $p\in SpecB$,the induced map $g^\sharp_p:O_{SpecA,f^{-1}(p)} \to O_{SpecB,p}$ is injective.In the language of category,this fact states that since the category of affine schemes is equivalent to the opposite category of the category of commutative rings with identity,so injectivity of ring homomorphisms is equivalent to injectivity of morphisms of affine schemes,note that injectivity of morphisms of sheaves is equivalent to injectivity of morphisms of sheaves on stalks,hence the result is not strange.