Let us show how to find such a retraction for $n=2$ (the general case is analogous but technically more complicated).

Given a compact set $C\subset\mathbb R^2$ and an open neighborhood $U\subseteq\mathbb R^2$ of $C$, choose a triangulation on $\mathbb R^2$ so fine that no triangle of the triangulation meets $C$ and $\mathbb R^2\setminus U$ simultaneously. 

Without loss of generality we can assume that for each triangle of the triangulation either $C$ meets the interior of the triangle or else $C$ intersects at most two sides of the triangle. If $C$ intersects three sides of the triangle but does not intersect the interior, then we can divide this triangle into two triangles having at most two sides intersecting $C$. 

Let $K^{(0)}$ be the set of vertices of the triangulation and let $K$ be the family of subsets $\sigma\subset K^{(0)}$ whose convex combinations are vertices, edges or triangles of the triangulation. The set $K$ can be written as the union $K=\bigcup_{n=1}^3K^{(n)}$ where $K^{(n)}=\{\sigma\in K:\sigma$ has exactly $n$ elements$\}$. 

For a set $\sigma$ let $\bar\sigma$ be the convex hull of $\sigma$, $\partial\sigma$ be the combinatorial boundary of $\bar\sigma$ and $\sigma^\circ=\bar\sigma\setminus\partial\sigma$ be the combinatorial interior of $\bar\sigma$. 

Let $K_C=\{\sigma\in K:\bar\sigma\cap C\ne\emptyset\}$ and $V=\bigcup\{\sigma^\circ:\sigma\in K_C\}$.

Then $V$ is an open neighborhood of $C$. We claim that there exists a retraction of $\mathbb R^2\setminus C$ onto $\mathbb R^2\setminus V$. For every simplex $\sigma\in K^{(2)}\cap K_C$  the set $C$ either intesects $\sigma^\circ$ of intersect at most two 1-simplexes of the boundary $\partial \sigma$. In both cases we can construct a retraction  $r_\sigma:\bar\sigma\setminus C\to\partial \sigma\setminus C$.
For every $\sigma\in K^{(2)}\setminus K_C$ let $r_\sigma$ be the identity map of $\bar\sigma$.

 The union of the retraction $r_\sigma$, $\sigma\in K^{(2)}$, is a retraction of $\mathbb R^2\setminus C$ onto the set $S=(\mathbb R^2\setminus V)\cup\bigcup_{\sigma\in K^{(1)}\cap K_C}(\bar\sigma\setminus C)$. Then do the same with the set $K^{(1)}\cap K_C$: for every 1-simplex $\sigma\in K^{(1)}\cap K_C$, use the fact that $\bar\sigma\cap C\ne\emptyset$ and find a retraction $r_\sigma:\bar\sigma\setminus C\to\partial \sigma\setminus C$. The union of those retractions and the identity maps $r_\sigma$ for $\sigma\in K^{(2)}\setminus K_C$ retract the set $S$ onto the set $$S'=(\mathbb R^2\setminus V)\cup \bigcup_{\sigma\in K^{(2)}\cap K_C}(\sigma^{(0)}\setminus C).$$

Since the set $S'\setminus(\mathbb R^2\setminus V)$ is finite, here exists a retration of $S'$ onto $\mathbb R^2\setminus V$. So, our final retraction $\mathbb R^2\setminus C\to\mathbb R^2\setminus V$ is the composition of the retractions $\mathbb R^2\setminus C\to S\to S'\to\mathbb R^2\setminus V$.