A morphism between affine schemes. Suppose one has a morphism $\phi$ between a ring $R$ and $S$ that induces a morphism of schemes associated to this $\phi$. So one has a map $(f,f^{\#}):X\rightarrow Y$, where $X=\operatorname{Spec}(S)$ and $Y=\operatorname{Spec}(R)$. Where for each open $V\subset Y$ we have a map $f_{V}^{\#}:\mathcal{O}_{Y}(V)\rightarrow \mathcal{O}_{X}(f^{-1}(V))$. Now suppose that $V$ is a distinguished open for which there exists $a,b\in R$ with $a\neq b$ and $V = Y_{a} = Y_{b}$. Then notice that $\mathcal{O}_{Y}(V) = R_{a}$, but also $\mathcal{O}_{Y}(V) = R_{b}$. But as sets clearly $R_{a}\neq R_{b}$. 
My Question: How can this go right? 
I think that the equalities $\mathcal{O}_{Y}(V) = R_{a}$ and $\mathcal{O}_{Y}(V) = R_{b}$, are actually isomorphisms instead of real equalities, but I am not sure. 
Second Question: If this solves the problem, to describe the function $f^{\#}_{V}$ on a distinguished open $V$ is it enough to just pick some $a\in R$ such that $V = Y_{a}$?
 A: I'm not sure why you think "clearly $R_a\neq R_b$". For instance if you take $R=\Bbb Z$ and say $a=2$, $b=4$, then $R_a=R_b$ is literally an equality if you are considering both as subsets of $\Bbb Q$. 
More generally, for arbitrary $R$ we have $Y_a=Y_b\iff a^n\in(b)$ and $b^m\in(a)$ for some $n,m\in\Bbb N$. From this you can deduce a canonical isomorphism $R_a\cong R_b$.
However, truly I agree with you that taking $\mathcal O_Y(Y_a):=R_a$ as a definition is not good, because we shouldn't have to implicitly be passing through "canonical" isomorphisms in the situation you describe in your question. So here is an alternative way to describe the structure sheaf:

If $V\subset Y$ is a distinguished subset, define $\mathcal O_Y(V)$ to be the localization of $R$ at the multiplicative subset $\{a\in R\mid Y_a\subset V\}$.

Now it doesn't depend on some choice of $a$ for which $V=Y_a$, but it will "match up" with the definition you are familiar with via the following

Exercise If $V=Y_a$ then there is a natural map $R_a\to\mathcal O_Y(V)$ and this map is an isomorphism.

Now you can define the maps in question purely in terms of this new definition of $\mathcal O_Y(V)$, and you can show that through the isomorphism above it really does "agree" with the definition you had before (more precisely, some diagram will commute).
