Let $\Omega$ be an open set with compact closure denoted by $\overline{\Omega}$ and a null set $N\subset\Omega$ with respect the Lebesgue measure.
Then consider the two sets
- $C^{\infty}(\overline{\Omega})$ (smooth functions in $\overline{\Omega}$).
- $V=\{\psi\in C^{\infty}(\overline{\Omega}/N) \text{ with } \psi=\psi_{a_{1}}=...=\psi_{a_{1}...a_{k}}=0 \text{ in } N \} \cup \{\psi\in C^{\infty}(\overline{\Omega}) \text{ with } \psi=\psi_{a_{1}...a_{k}}=0 \text{ in } N \}$
So $V$ is the set of all $\phi\in C^{\infty}(\overline{\Omega})$ functions where the value of $\phi$ and and its first $k$ derivatives is change to be $0$ at $N$.
Now is $V$ dense in $W^{k,p}(\Omega)$?
I think it is for the following reason:
Consider $\phi\in C^{\infty}(\overline{\Omega})$ then $\phi\in W^{k,p}$. Now this $\phi$ is in the same class as $\phi_{n}$ which is just $\phi$ everywhere except possibly at $N$.
So "according to" the $W^{k,p}(\Omega)$ space $\phi_{n}$ is $\phi$ in $W^{k,p}(\Omega)$. And then we know that the class of $C^{\infty}(\overline{\Omega})$ is dense in $W^{k,p}(\Omega)$.
This conclude the argument as we have prove that that $C^{\infty}(\overline{\Omega})\subset V$ as classes in $W^{k,p}(\Omega)$
Why is this argument incorrect?
The argument is incorrect.
Suppose $\phi \in C^\infty(\bar{\Omega}) \subset W^{k,p}(\Omega)$. As you say, we can define a function $$\phi_n(x) = \begin{cases} \phi(x), & x \notin N \\ 0, & x \in N \end{cases}$$ Then $\phi_n$ is a function that vanishes on $N$ and is almost everywhere equal to $\phi$. However, $\phi_n$ typically will not be $C^\infty$, so it is not an element of your set $V$, which you specifically defined to consist only of $C^\infty$ functions. Generally, if you modify a continuous function on a null set, it will no longer be continuous. (A null set has a dense complement, so if $\phi$ and $\phi_n$ are both continuous and are equal on $N^c$, they must also be equal on $N$.)
For an explicit counterexample, let $n=1$, $p=1$, $\Omega = (0,1)$ and $N = \Omega \cap \mathbb{Q}$. If $\phi \in C^\infty$ and $\phi'$ vanishes on $N$ then $\phi$ is constant. Likewise if $\phi$ vanishes on $N$ then $\phi = 0$. So $V$ only contains the constants, or more properly, $V$ consists of those equivalence classes which contain a constant function. For a function to be in one of the equivalence classes in $V$, it must be almost everywhere equal to a constant. This is a closed subset of $W^{k,p}(\Omega)$ and is certainly not dense.