$C^\infty_{0}(\bar\Omega)$ dense in $W^{k,p}(\Omega)$: the closure is necessary? It is a fundamental result of Sobolve space that

Let $\Omega \subset \mathbb{R}^d$ or $\mathbb{R}^d_+$, then
  $C^\infty_{0}(\bar\Omega)$ is dense in $W^{k,p}(\Omega)$.

However, in some literatures, the fact is pointed out that $C^\infty_{0}(\Omega)$ fails to dense in $W^{k,p}(\Omega)$ in some cases.
Some I would like to try some counterexamples.
My guess is take $d = 1, k = 1, p = 2$ and $\Omega = (0,1)$, i.e. claim that

$C^\infty_{0}((0,1))$ fails to dense in $W^{1,2}((0,1))$.

But how should I proceed such an argument in a precise way?
 A: Just like Chris said in his comment, let us suppose we have a bounded Lipschitz domain $\Omega\subset \mathbb{R}^d$, $C^{\infty}_0(\Omega)$ fails to approximate an arbitrary $W^{k,p}(\Omega)$-function unless you set the boundary value to be 0. 
A possible argument could be constructed using the trace theorem. Roughly speaking,  denote $H^1(\Omega) := W^{1,2}(\Omega)$, let
$$
T: H^1(\Omega) \longrightarrow H^{1/2}(\partial \Omega)
$$
be the trace operator. Suppose we prescribe a $u\in H^{1}(\Omega)$, which has a non-zero trace, leading us to the trace inequality
$$
\|Tu \|_{H^{1/2}(\partial \Omega)} \leq c\| u \|_{H^1(\Omega)}
$$
Now assume we have a sequence $\{u_n\}\subset C^{\infty}_0(\Omega) \subset H^1(\Omega)$, such that $u_n\to u$ in the $H^1(\Omega)$-norm, then use trace inequality we will see the contradiction in which zero is greater than or equal to a positive number.

If you are not satisfying with the existence of the "non-zero trace" part, we could circumvent this by using the surjectivity of the trace operator, define its right inverse as
$$
\mathscr{I}: H^{1/2}(\partial \Omega)\longrightarrow H^1(\Omega)
$$
serving like an extension of any function defined on boundary to the interior, and $T(\mathscr{I}g) = g$ for any $g\in H^{1/2}(\partial \Omega)$, prescribe any $g\in H^{1/2}(\partial \Omega)$, say $g = 1$ on $\partial \Omega$, let $u = \mathscr{I}g$.

Counter-example on $\Omega = (0,1)$: 
Let $u = 1\in H^1(\Omega) = W^{1,2}(\Omega)$, suppose we have a sequence $\{u_n\} \subset C^{\infty}_0(\Omega)$ such that 
$$
\| u - u_n\|^2_{H^1(\Omega)} = \| u - u_n\|^2_{L^2(\Omega)} + 
\| u'_n\|^2_{L^2(\Omega)} \longrightarrow 0
$$
so for any $\epsilon>0$ we could find $N>0$ for all $n>N$:
$$
\| u - u_n\|_{L^2(\Omega)} < \epsilon, \text{ and }\; \|u'_n\|_{L^2(\Omega)} < \epsilon
$$
By triangle inequality:
$$
\left|\| u\|_{L^2(\Omega)} - \| u_n\|_{L^2(\Omega)}\right| \leq \| u - u_n\|_{L^2(\Omega)} < \epsilon
$$
due to $\| u\|_{L^2(\Omega)} = 1$, above implies
$$
1-\epsilon < \| u_n\|_{L^2(\Omega)} < 1+\epsilon
$$
Now we would like to argue like the proof for Poincaré inequality to reach the contradiction, for 1 dimensional case it is very straightforward, for any $x\in \Omega$ we have:
$$
|u_n(x) - u_n(0)| = \left| \int^x_0 u'_n(t)\,dt\right| \leq 
\left| \int^1_0 u'_n(t)^2\,dt\right|^{\frac{1}{2}} \;
\left| \int^1_0 1^2\,dt\right|^{\frac{1}{2}}  = \|u'_n\|_{L^2(\Omega)}
$$
This implies $\displaystyle\sup_{x\in\Omega}|u_n(x)| \leq \|u'_n\|_{L^2(\Omega)}$, therefore combining everything we have would lead us to the following:
$$
1-\epsilon < \| u_n\|_{L^2(\Omega)} \leq 
\left| \int^1_0 \sup_{t\in\Omega}|u_n(t)|^2\,dt\right|^{\frac{1}{2}}  = \sup_{x\in\Omega}|u_n(x)| \leq \|u'_n\|_{L^2(\Omega)} < \epsilon
$$
which is a contradiction, hence such sequence $\{u_n\} \subset C^{\infty}_0(\Omega)$ does not exist.

A last remark: Why would the density argument of $C^{\infty}_0(\Omega)$ is true for the whole space is because of the decaying property of both the function itself and the derivative of the $W^{k,p}$-functions, for something to be $L^p$-integrable on the whole space, its integration must be small outside a ball of certain size, however for bounded domain, decaying property does not hold any more unless you add the compactly-supported condition.
A: Let $f(x) = \cosh(x) = \tfrac{e^x+e^{-x}}2$ for $x\in (a,b)$. Then obviously $f\in C^\infty(a,b)\subset H^1(a,b)$ with $f'' = f$. Hence, for all $u\in C_0^\infty(a,b)$ we have
$$
(f,u)_{H^1} = (f,u) + (f',u') = (f,u) + [f'\overline u]_a^b - (f'',u) = (f-f'',u) = 0.
$$
Therefore $C_0^\infty(a,b)$ is not dense in $H^1(a,b)$.
