I'm reading these notes (page 10) on the Etale fundamental group and am confused on a small point.
I don't think that surjectivity can in general be determined in the stalks of a ring homomorphism. If $\phi: Y \rightarrow X$ is the map of spectra corresponding to $f$, then $A_{\mathfrak p} \rightarrow B_{\mathfrak p}$ is surjective for all $\mathfrak p$ if and only if the morphism of sheaves $\phi^{\#}: \mathcal O_X \rightarrow \mathcal O_Y$ is an epimorphism. But this can be the case without the global section map $A = \mathcal O_X(X) \rightarrow \mathcal O_Y(Y) = B$ being surjective. In fact, surjectivity of $f$ is equivalent to surjectivity of $\phi^{\#}$ and $\phi$ being a closed immersion of topological spaces.

You are both right and wrong. Yes, surjectivity is not a local property, you may have a map of sheaves which is surjective at each stalk but not surjective on global sections: the point is that there is an obstruction in the $H^1$ of the kernel sheaf. However, in your situation everything is affine, and quasi-coherent sheaves on affine schemes are acyclic, i.e. they have trivial $H^i$ for $i>0$, hence in this situation the argument actually works.