Let $\mathbb{D}^n$ be the closed $n$-dimensional unit ball, and let $f:\mathbb{D}^n \to \mathbb{R}^n$ be smooth. Suppose that $df$ is invertible outside a set of Hausdorff dimension $\le n-1$, and that $\text{rank}(df) \ge n-1 $ on $\partial \mathbb{D}^n$.
Question: Do there exist $f_n \in C^{\infty}(\mathbb{D}^n, \mathbb{R}^n)$ such that $f_n \to f$ in $W^{1,2}(\mathbb{D}^n, \mathbb{R}^n)$ and $\text{rank}(df_n) \ge n-1 $ everywhere on the interior $ \text{Int}(\mathbb{D}^n) $?
Easier question:
My intuition is that the set of points where the rank is less than $n-1$ should be very small (generically). Indeed, it is the set where all the $n-1$-minors of $df$ vanish; these are $n^2$ (independent?) equations. Thus, I expect that typically, the Hausdorff dimension of this set would be zero. Can we prove that?
That is, can we find $f_n \in C^{\infty}(\mathbb{D}^n, \mathbb{R}^n)$ such that $f_n \to f$ in $W^{1,2}(\mathbb{D}^n, \mathbb{R}^n)$ and $\dim_{\mathcal H}(\{ p \, | \, \text{rank}(df_n)_p < n-1 \})=0$?
Edit 2:
As commented by Dap, the algebraic set of matrices of rank $\le n-2$ has codimension 4. So, for $n \ge 5$ we shouldn't expect to get dimension $0$ just by generic modifications and dimension arguments. However, we may get dimension $0$ for dimension $n=4$. (Can this be formalized?)