Let me just spell out my above comment in more detail. By Tag 04XV it suffices to clarify why your assumption that $X(A)\to Y(A)$ is an injection for all $k$-algebras implies that $X\to Y$ is a monomorphism.
Let us fix a base scheme $S$ and two $S$-schemes $X$ and $Y$.
Definition: A morphism of $S$-schemes $f\colon X\to Y$ is called a monomorphism if for any $S$-scheme $Z$ and maps $a,b\colon Z\to X$ the equality $f\circ a=f\circ b$ implies that $a=b$.
Note this is equivalent to the diagonal map $\Delta_f\colon X\to X\times_Y X$ being an isomorphism in the category of $S$-schemes. This observation indicates that the base $S$ plays no real role here : no part of the diagonal map depends on $S$, nor does it being an isomorphism. So, while the Stacks Project reference takes $S=\mathrm{Spec}(\mathbb{Z})$ (i.e. has no base), your conditions make it convenient to work with $S=\mathrm{Spec}(k)$.
So, let us show that the conditions you stated imply that $f\colon X\to Y$ is a monomorphism of $k$-schemes.
Proposition: Let $S$ be a scheme. Then, the functor $\mathbf{Sch}_S\to \mathbf{PSh}(\mathbf{Aff}_S)$ given by $X\mapsto h_X$ is faithful.${}^{\color{red}{(1)}}$
Here
- $\mathbf{Sch}_S$ is the category of all $S$-schemes,
- $\mathbf{Aff}_S$ the full subcategory of $\mathbf{Sch}_S$ consisting of affine $S$-schemes (affine in the sense that they are actually affine, not the map to $S$ is affine)
- $\mathbf{PSh}(\mathbf{Aff}_S)$ is the category of presheaves on $\mathbf{Aff}_S$,
- $h_X$ is the representable presheaf $\mathrm{Hom}_{\mathbf{Sch}_S}(-,X)$ on $\mathbf{Aff}_S$.
Proof: By Yoneda's lemma we know that $h_\bullet$ fully faithfully embeds $\mathbf{Sch}_S$ into $\mathbf{PSh}(\mathbf{Sch}_S)$. So, it suffices to show that the restriction functor $\mathbf{PSh}(\mathbf{Sch}_S)\to\mathbf{PSh}(\mathbf{Aff}_S)$ is faithful. This amounts to the claim that if $X_1(A)\to X_2(A)$ is injective for all $\mathrm{Spec}(A)\to S$ in $\mathbf{Sch}_S$ then $X_1(T)\to X_2(T)$ is injective for any $T\to S$ in $\mathbf{Sch}_T$. But, recall that every $S$-scheme admits a canonical decomposition into a colimit of its affine open subschemes (see this). So, if we write $T=\mathrm{colim}\,\, \mathrm{Spec}(A)$ then it's not hard to see that $X_1(T)\to X_2(T)$ is $\lim\,\, (X_1(A)\to X_2(A))$. As the limit of injections is an injection, we're done. $\blacksquare$
Why is this useful? Well, it's trivial to see that if $F\colon \mathcal{C}\to\mathcal{D}$ is a faithful functor then $F(f)$ is a monomorphism implies that $f$ is a monomorphism : if $F(f\circ a)=F(f\circ b)$ then $F(f)\circ F(a)=F(f)\circ F(b)$ so $F(a)=F(b)$ and so $a=b$. Applying this for $h_{\bullet}\colon \mathbf{Sch}_S\to\mathbf{PSh}(\mathbf{Aff}_S)$ shows that if $h_X\to h_Y$ is a monomorphism on $\mathbf{PSh}(\mathbf{Aff}_S)$ then $X\to Y$ is a monomorphism. But, $h_X\to h_Y$ being injective as a map on $\mathbf{PSh}(\mathbf{Aff}_S)$ is precisely the statement that $X(A)\to Y(A)$ is injective for all objects $\mathrm{Spec}(A)\to S$ of $\mathbf{Aff}_S$.
$\color{red}{(1)}$ : In fact, the representable presheaf actually defines a fully faithful embedding into $\mathbf{Psh}(\mathbf{Aff}_S)$ which actually factorizes through the category of sheaves over many Grothendieck topologies on $\mathbf{Aff}_S$. A good reference for this is [Olsson, ยง1.4].
References:
[Olsson] Olsson, M., 2016. Algebraic spaces and stacks (Vol. 62). American Mathematical Soc..
Best Answer
1) Correct, I don't know; the most general useful notion is probably the last one, where you can factor it into an open immersion followed by a closed one. This, for example, "immerses" the affine line $\mathbb A^1$ into the projective plane $\mathbb P^2$ via $x\mapsto (x:1)\in \mathbb P^1$ followed by $(x,y)\mapsto (x:y:0)\in \mathbb P^2$.
2) A closed immersion is like, for example, a line in the affine plane: It embeds the variety as a closed subvariety. The affine line into the projective line in 1) above is an example of an open immersion.
3) Injectivity is not sufficient to guarantee a closed immersion; see, for example, the map from the affine line to the cuspidal cubic $(t^2,t^3)$ in $\mathbb A^2$. The key thing is that pullback gives a surjective map of structure sheaves (coordinate rings in the affine case). It happens in the examples you give that this surjectivity holds.