Rings of fractions and homomorphisms
Let the ring of fractions be denoted as $S^{-1}R$.
Proposition (from Robert Ash's textbook "Basic Abstract Algebra")
Define $f: R \rightarrow S^{-1}R$ by $f(a) = a/1$. Then f is a ring homomorphism. If S has no zero divisors then f is a monomorphism, and we say that R can be embedded in $S^{-1}R$. In particular:
(i) A commutative ring R cna be embedded in its complete (or *full) ring of fractions ($S^{-1}R$, where S consists of all non-divisors of zero in R).
(ii) An integral domain can be embedded in its quotient field.
Why does the proposition say "If S has no zero divisors..."? If S really had zero divisors, then this wouldn't even be properly defined, right? Because we would have a/0 for some a in R.
I don't know how your book defines the ring of fractions, but the right (i.e. the most general as possible) way of doing things with rings of fractions is this :
If $M$ is an $R$-module and $1 \in D \subseteq R$ is a subset of $R$ which is multiplicatively closed, then we define $D^{-1} R$ as follows. Define the following equivalence relation over $D \times M$ : $(d_1, m_1) \sim (d_2, m_2)$ if there exists $d \in D$ such that $d(d_1 m_2 - d_2 m_1) = 0$. You can check that this defines an equivalence class over $D \times M$ (the details are okay to work out, nothing hard), and in the case where $M = R$ and $R$ is an integral domain, you can get rid of the condition 'there exists a $d \in D$ such that' because it is not necessary.
Defining the addition as usual over $D^{-1} M$, this makes $D^{-1}M$ into an abelian group. In particular, since $R$ is an $R$-module over itself, we can define $D^{-1}R$. Considering the particular case of $D^{-1}R$ alone first, we can define multiplication as $\frac{r_1}{d_1} \frac{r_2}{d_2} = \frac{r_1 r_2}{d_1 d_2}$. This makes $D^{-1}R$ into a ring, so now we can say that the scalar multiplication $\frac{r}{d} \frac{m}{d'} = \frac{rm}{dd'}$ makes $D^{-1}M$ into a $D^{-1}R$-module.
(I used the letter $D$ because it stands for denominators. The letter $S$ is probably just used because of the alphabet...)
In this kind of generality, if you want to make $D^{-1}R$ into an integral domain, you need to make some assumptions on $D$. For instance,
Note that the set $D$ of all non-zerodivisors is a multiplicatively closed subset of $R$ which contains $1$. This means that if $\frac a1 = \frac b1$, there exists $d \in D$ such that $d(a-b) = 0$, but $d$ is not a zero-divisor, then $a-b =0$ and $a=b$, hence the remark that $f$ is a monomorphism in this case. If $D$ contains a zero divisor, you can have some fraction $\frac r1 = \frac 01$ without having $r=0$, because this equation only means that there exists $d \in D$ such that $rd = 0$. The equivalence class of $\frac 01$ contains precisely those $r \in R$ that are zero divisors.
In an integral domain, there are no zero-divisors, so by the above remark the map $f$ is an embedding of $R$ into its quotient field $D^{-1}R$ (where $D$ is the set of non-zero elements, which is also the set of non-zero divisors in this case). Note that $D^{-1}R$ is a field because a fraction $\frac rd$ is never equivalent to $\frac 0{d'}$ for some $d'$, hence we can take its inverse to be $\frac dr$.
Hope that helps! Feel free to ask any questions about the details.
We know the following: The localization $S^{-1}R$ is zero if and only if $0\in S$. Now, if $a\in R$ is a zero-divisor and $a\in S$, then there is some $b\neq 0$ in $R$ such that $ab=0$. But that $b$ doesn't have to be in $S$, so we can't conclude $0\in S$.
Some books require $0\notin S$. I think Kaplansky does (Commutative Rings), but Atiyah-MacDonald doesn't (Introduction to Commutative Algebra). Does Ash?
In any case, here's an example of a ring localized at a set containing zero divisors but the localization is not zero: Let $k$ be a field and put $R= k[x,y]/(xy)$. Then $x\in R$ is a zero-divisor. Put $S= \{ 1,x,x^2,x^3,\ldots\}$ and consider the localization $S^{-1}R$. I claim it's not zero (look at the image of $1$ under $R \to S^{-1}R$). Now, can you find two distinct elements in $R$ that map to the same place in the localization? I think something like $x^2$ and $x^2+y$ would work (or even $0$ and $y$.).
The construction works fine to invert elements from any submonoid $\,S.\,$ If it ends up inverting $0$ then it simply produces the trivial ring $0$. If the ring has zero-divisors then some of them may get killed in the image. More precisely, the kernel of the natural map of $\, R\to S^{-1}R\,$ consists of all elements $\,r\in R\,$ such that $\, r s = 0\,$ in $\,R,\,$ for some $\,s\in S,\,$ e.g. since $\,2\cdot 5 = 0\in\Bbb Z_{10}\! = \Bbb Z/10\,$ after adjoining $\,\frac{1}2\,$ we can cancel the $\,2\,$ to get $\,5 = 0.\,$ In fact, $\,\Bbb Z_{10}[\frac{1}2] \cong \Bbb Z_5.$
Take a look at at the standard definition of the equivalences of fractions:
$$ (a,s)\sim(b,s')\iff \exists t\in S, t(as'-sb)=0 $$
Suppose for a moment that $0\notin S$ and that $r\neq 0$. If $r/1\sim 0/1$ (that is, if $r$ is in the kernel of the map $r\mapsto r/1$) then there would have to be a $t\in S$ such that $t(r-0)=0$. But this says that $t$ is a zero divisor in $S$. By contrapositive if $S$ had no zero divisors, then $r\mapsto r/1$ is injective.
Now for the second thing you mentioned about $r/0$ being defined or not. There is nothing inherently wrong with $0\in S$, but things are a bit trivialized since the ring of fractions collapses to $\{0\}$. Everything is defined but it is not very interesting.
One way to see that is that $(x,y)\sim(0,1)$ for each pair $(x,y)$ since $0$ is available in $S$ to power the equation $0(x\cdot1-0y)=0$. Thus there is only one equivalence class in the ring of fractions: that of $0/1$. (And certainly here the map $r\mapsto r/1$ is not injective! This justifies my earlier supposition that $0\notin S$ in the first paragraph.)