By Alexander duality, $\mathbb{R^3}\setminus S$ has two connected components.
Let $u\colon \mathbb{R^3}\to \mathbb{R^3}\setminus (A\cup B)$ be the universal covering. Denote it by $\tilde S$ a lift of $S$.
Again, by Alexander duality $\mathbb{R^3}\setminus \tilde S$ has two connected components, one of them, say $\Omega$ is bounded.
Observe that $f(\Omega)$ is one of the components of $\mathbb{R^3}\setminus S$ and it does not contain $A$ nor $B$. It follows that both $A$ and $B$ lie in the other connected component --- a contradiction.