If $R$ is UFD, then $R[X]$ is UFD (see any textbook).
If $R$ is UFD and $f \in R \setminus \{0\}$, then $R[\frac{1}{f}]$ is UFD. The prime elements are those of $R$ which don't divide $f$. Proof: They are prime because of the classification of prime ideals of localizations. If $0 \neq a \in R[\frac{1}{f}]$, say $a=x/f^k$, then $x$ is a product of prime elements. Those which divide $f$ are units in $R[\frac{1}{f}]$. Thus $a$ is associated to a product of the distinguished prime elements.
"Those which divide $f$ are units in $R[\frac{1}{f}]$." I don't understand why, I think it could help if you give a concrete example? Or, maybe if you want to, you can expand it to a full proof, because I find this difficult on multiple points.
– 1234aaaOct 29 '13 at 00:37