Given a sequence of reals, we can find a dense sequence avoiding it, but can we find one continuously?

I think there is not such an $f:S\to S$. Consider the sequence $x^t\in S$ continuously depending on $t\in[0,1]$, such that $x_0^t=-t$ and $x_n^t=1/n $ for all $n\ge1$. Since $f(x^1)$ is dense, for some index, say $17$, we have $-1 <f_{17}(x^1)<0$. Therefore, for $t=1$, we have $$-t=x^t_0<f_{17}(x^t)<x^t_n=1/n$$ for all $n\ge1$. By continuity this must hold for all $0\le t\le1$, but it is impossible for $t=0$.


If you replace the reals $\mathbb{R}$ with Cantor space $2^{\mathbb{N}}$ or with Baire space $\mathbb{N}^{\mathbb{N}}$ (homeomorphic to the space of irrationals), then the answer is yes. Indeed, one can have the function defined on the whole space of sequences, not just the injective ones.

To see this, define $f(x_0,x_1,...)=(y_0,y_1,...)$, where $y_k$ extends the $k^{th}$ finite sequence $u_k$, and diagonalizes the $x_n's$ in a canonical way beyond the length of $u_k$, so that the $|u_k|+j^{th}$ digit of $y_k$ is different from the $|u_k|+j^{th}$ digit of $x_j$. This is a continuous function, since any finitely many digits for the output are determined by finitely many digits of the input. The $y_k$'s are not among the $x_n$, since they diagonalize against this list, and the $y_k$'s are dense, because $y_k$ extends $u_k$. (By changing the diagonalization procedure slightly, it is easy to arrange that the $y_k$ are all distinct.)