Here is a general approach that can be applied here. Suppose $A$, $B$, and $C$ are disjoint sets, where $A$ and $B$ are countably infinite. Then, we can construct an bijective function $\phi$ from $A\cup B\cup C$ to $B\cup C$, which maps $A\cup B$ onto $B$, and $C$ onto $C$. To do this, arrange the terms of $A$ and $B$ into sequences of distinct elements, so that $A=\{a_0,a_1,a_2,\dots\}$ and $B=\{b_0,b_1,b_2,\dots\}$. Define $\phi$ as follows:
$$
\phi(x)=
\begin{cases}
b_{2i} &\text{if $x=a_i$ for some $i\in\mathbb N$} \, , \\
b_{2i+1} &\text{if $x=b_i$ for some $i\in\mathbb N$} \, , \\
x &\text{otherwise.}
\end{cases}
$$
This function maps the members of $A$ to the members of $B$ with even indices, and the members of $B$ to the members of $B$ with odd indices, while keeping the members of $C$ fixed in place.
To apply this method to construct a bijection between $\mathbb R$ and $\mathbb R\setminus\mathbb Q$, we can set:
- $A=\mathbb Q$
- $B=\{k\sqrt{2}:k\in\mathbb Z^+\}$
- $C=\mathbb R\setminus(A\cup B)$
Let $f$ be a bijection from $\mathbb N$ to $\mathbb Q$ (see here for an explicit example), and put $a_i=f(i)$. Then, put $b_i=(i+1)\sqrt2$.
Finally, note that WimC's elegant answer uses the same principle. We split $\mathbb R$ into three disjoint sets:
- $A=\mathbb Q$
- $B=\{q+k\sqrt2:q\in\mathbb Q,k\in\mathbb Z^+\}$
- $C=\mathbb R\setminus(A\cup B)$
Then, we map $A\cup B$ onto $B$, and $C$ onto $C$. The only difference between his and my approach is the way in which $A\cup B$ is mapped onto $B$.