  We prove some results on when functions on compact sets $K \subset \mathbb C$
can be approximated by polynomials avoiding values in given sets. We also prove
some higher dimensional analogues. In particular we prove that a continuous
function from a compact set $K \subset \mathbb R^n$ without interior points to
$\mathbb R^n$ can be uniformly approximated by a polynomial mapping avoiding
values in any given countable set $A \subset \mathbb R^n$, giving a real
$n$-dimensional analogue of a recent version of Lavrentiev's theorem of
Andersson and Rousu. We also prove the same result for infinite dimensional
Banach spaces.
