If $J \subseteq \mathcal{O}_X$ is an ideal, the corresponding zero set is $V(J) = supp \mathcal{O}_X / J$. It is a closed subset of $X$, let $i$ be the inclusion. Then the associated closed sub-locally ringed space of $X$ is defined to be $(V(J),i^{-1} (\mathcal{O}_X/J))$. It has the desired universal property, maps to $V(J)$ are just maps to $X$ such that the sheaf map vanishes on $J$. If $X$ is a scheme and $J$ is quasi-coherent, it turns out that $V(J)$ is a scheme.
If we take $i^{-1} \mathcal{O}_X$ instead of $i^{-1}(\mathcal{O}_X/J)=i^{-1} \mathcal{O}_X / i^{-1} J$, the universal property does not hold anymore and if $X$ is a scheme and $J$ quasi-coherent, in general, this is not a scheme anymore. The reason is simply that here points and functions are not really connected with each other.
If you like to think about closed subsets, remark that every closed subset $A$ arises as $V(J)$. Simply take $J(U) = \{f \in \mathcal{O}_X(U) : f_x \in \mathfrak{m}_x ~~ \forall x \in U \cap A\}$.
For example if $X$ is a scheme and $x$ is closed point of $X$, take $A = \{x\}$. Then $(A,i^{-1} \mathcal{O}_X)$ is the locally ringed space on $A$ with sections $\mathcal{O}_{X,x}$, which is only a scheme if $\mathcal{O}_{X,x}$ has only one prime ideal.