You don't have to work over a base field for your statement. That is, you can just work with the category of (commutative) rings.
See Theoreme 1.20 on page 15 in David Harari's notes for his course on algebraic geometry
http://www.math.u-psud.fr/~harari/enseignement/geoalg/cours.pdf
This theorem implies, by definition, that the contravariant functor Spec from the category of (commutative) rings to the category of locally ringed spaces is fully faithful.
The essential image of Spec is what we call the category of affine schemes. If you're not familiar with the term "essential image", this definition implies that an affine scheme is a locally ringed space isomorphic to Spec$(A)$ for some ring $A$.
Proofs of this statement can also be found in Liu's Algebraic geometry and arithmetic curves. Namely, see Lemma 2.3.23 on page 48. (This is if you prefer reading in English as opposed to French.)
It's also in Chapter 2.2 of Hartshorne.
If you're uncomfortable with not working over an algebraically closed base field, you could also consult Chapter 1 of Hartshorne. The analogue of the statement you're looking for is, I believe, proved in Section 1.3. (I don't have Hartshore here with me, so I might be wrong.)
(Remarque inutile: As a consequence of the statement in Harari's notes (or Liu's book), the Spec functor is an equivalence of categories onto its essential image: the category of affine schemes.)