I'm fairly certain there is both a typo and an omission in this exercise. It reads
"Let $X$ be a scheme and $f \in \mathcal{O}_X(X)$. Show that $U \mapsto f|_U \mathcal{O}_X(U)$ for every affine open subset $U$ defines a sheaf of ideals on $X$. We denote this sheaf of ideals by $f \mathcal{O}_X$..."
Surely "affine" above should be omitted, but my real question is
are we missing any hypotheses on $f$?
It is clear that $f \mathcal{O}_X$ defines a presheaf satisfying the uniqueness condition, i.e., if an global section restricts to zero everywhere on an open over, then the element is identically $0$, as $\mathcal{O}_X$ is a sheaf to begin with. However, in proving that is satisfies the criterion regarding the glueing of local sections,
do we not need the hypothesis that $f|_U$ is not a zero-divisor for all $U$?
This is the only condition in which I'm able to get at the result. Am I missing anything?
EDIT: Please see Martin Brandenburg's answer. I was mistaken. (But it was not a regrettable mistake, as the point which I missed deserves an extra line or two of qualification.)
"Surely "affine" above should be omitted"
No! The presheaf $U \mapsto (f|_U)$ is not a sheaf in general. But the associated sheaf is given on affine opens by this formula.
This sheaf is best seen as a special case of general constructions (whereas doing the exercise directly is unnecessarily cumbersome). Let $M$ be a quasi-coherent sheaf on $X$ (in the exercise $M = \mathcal{O}_X$) and $f$ a global section of $\mathcal{O}_X$. Then $f$ induces a homomorphism $f : M \to M$. It is well-known that the category of quasi-coherent sheaves is abelian, in particular we can construct the image of $f : M \to M$, denoted by $fM$, which is a quasi-coherent subsheaf of $M$. Obviously this construction is local on $X$. If $X=\mathrm{Spec}(A)$ is affine, then there is an equivalence of categories between quasi-coherent sheaves on $X$ and $A$-modules, given by the global section functor. This equivalence preserves, in particular, images.
For general $X$ it follows that for every open affine $U \subseteq X$ the module $\Gamma(U,fM)$ is the image of $f|_U : \Gamma(U,M) \to \Gamma(U,M)$, i.e. $\Gamma(U,fM) = f|_U \cdot \Gamma(U,M)$. This does not hold for arbitrary opens $U$. In that case we only have $f|_U \cdot \Gamma(U,M) \subseteq \Gamma(U,fM)$. The converse holds when $f$ is regular (i.e. $f : M \to M$ is a monomorphism), and this is what you have proven:
If $s \in \Gamma(U,fM)$, there is an open covering $U = \cup_i U_i$ and sections $t_i \in \Gamma(U_i,M)$ satisfying $s|_{U_i} = f|_{U_i} \cdot t_i$. We have $f|_{U_i \cap U_j} t_i|_{U_i \cap U_j} = f|_{U_i \cap U_j} t_j|_{U_i \cap U_j}$. Since $f|_{U_i \cap U_j}$ is regular, this shows $t_i|_{U_i \cap U_j}=t_j|_{U_i \cap U_j}$, i.e. the $t_i$ glue to a section $t \in \Gamma(U,M)$ satisfying $s = f|_U \cdot t$.
Perhaps someone can add an example for $\Gamma(U,f \mathcal{O}) \neq f|_U \cdot \Gamma(U,\mathcal{O})$ in a separate answer?