Dummit and Foote define an extension of a function as follows.
If $A \subseteq B$ and $g: A \to C$ and there is a function $f: B \to C$ such that $f \mid _A = g$, we shall say that $f$ is an extension of $g$ to $B$ (such a map $f$ need not exist nor be unique.)
I do not understand, in particular, the notion that $f$ may not exist. I tried to consider an edge case where $ g(a) = \frac{1}{a}$, which is clearly $g$ is undefined at $0$, so we may have $0 \in B \setminus A$. However, I can define $f$ in a piecewise manner, say, $f(b) = \frac{1}{b}$ if $b \in A$ and $f(b) = 5$ if $b \in B \setminus A$. This function is well-defined and, when restricted to $A$, is the same function as $g$.
Is there a way where this $f$ cannot exist?