I read the following result in real analysis:
Let $1 \leq p < \infty$ and $k \geq 0$. Then the space $C^\infty_c({\bf R}^d)$ of test functions is a dense subspace of $W^{k,p}({\bf R}^d).$
A known proof is given, for instance, in a lecture note (Lemma 2). I was told that this is not generally true for arbitrary open set $\Omega$ of ${\bf R}^d$. But I can't see why the proof of the statement above would break down if one just replaces ${\bf R}^d$ with $\Omega$. Would anybody point out where could possibly go wrong?

(This was supposed to be a comment but it is a bit too long)
If you take the $\|\cdot\|_{W^{1,p}}$ closure of compactly supported functions you only get the functions that vanish at the boundary. On $\mathbb{R}^n$ there is no boundary, so no problem. Similarly with higher order Sobolev spaces: on $W^{k,p}$ the closure of $C^\infty_c$ consists of those functions that vanish at the boundary with their $k-1$ derivatives.