Some basics of Sobolev spaces Let $W^{m,p}(\Omega) = \{ f \in L^p(\Omega): D^\alpha f \in L^p(\Omega) \text{ for multi-indices } |\alpha| \leq m\}$, where $D$ denotes the weak derivative. Let $W_0^{m,p}$ denote the closure of $C_c^\infty(\Omega)$ in $W^{m,p}(\Omega)$. 
Why is it true that $W_0^{m,p}(\mathbb{R}^d) = W^{m,p}(\mathbb{R}^d)$, but in general $W_0^{m,p}(\Omega) \subsetneq W^{m,p}(\Omega)$? 
I am trying to understand why there is a need to consider $W_0^{m,p}(\mathbb{R}^d)$. I'm guessing it's because the elements in $W^{m,p}(\Omega)$ can get really messy, but I don't have very good intuition about both spaces.
 A: There are really three Sobolev spaces, which in many situations are provably the same, but the details concerning boundary values are (unsurprisingly) a large technical issue.
The a-priori smallest space is the closure of _test_functions_ (compactly supported smooth, with support in the interior of the domain) with respect to the Sobolev norm. The a-priori middle-sized Sobolev space is the closure of _smooth_functions_ with respect to the Sobolev norm. The a-priori largest Sobolev space is the collection of distributions with the corresponding distributional derivatives in $L^p$. (A relatively recent book by Gerd Grubb, "Distributions and Operators", discusses the impact of boundary conditions.)
In nice situations, such as "free space" problems, all these spaces are readily proven to be the same.
With boundary issues, some not-necessarily intuitive things can happen, since Sobolev norms (while arguably more appropriate than $C^k$ norms for discussion of PDEs) are not instantly comparable to classical pointwise ($C^k$) norms. That is, there is the "loss" of $n/2+\epsilon$ arising in Sobolev's inequality.
Nevertheless, there are "trace theorems", which with smooth boundaries predict accurately what loss of Sobolev index occurs upon restriction to the boundary: it is half the codimension, so, typically, $1/2$. 
For example, an $L^2$ limit of test functions (supported in the interior) certainly can have non-zero boundary values. Raising the Sobolev-norm's index implies vanishing on the boundary in a (typically less-by-$1/2$) Sobolev space on the boundary. Comparison to $C^k$ norms is via Sobolev's inequality.
A: The difference between $W^{m,p}$ and $W_0^{m,p}$ is not merely a technical one. The idea of the space $W_0^{1,p}(\Omega)$ is that it consists of those functions in $W^{1,p}(\Omega)$ which take the value zero at the boundary of $\Omega$. For general $W_0^{m,p}$ ($m>1$) the derivatives up to order $m-1$ have to be zero at the boundary as well. Since the boundary of $\mathbb{R}^n$ is empty it makes sense that $W_0^{m,p}(\mathbb{R}^n)=W^{m,p}(\mathbb{R}^n)$.
Now to define what it means to restrict a Sobolev function to the boundary is not straightforward, because the boundary has measure zero and $L^p$-functions are in fact equivalence classes of functions, that is, they are only defined up to sets of measure zero.
The simplest way out of this is to use the definition you gave (closure of compactly supported smooth functions). It has the advantage that it is easy to work with. The drawback is of course that it is not obvious that the definition really captures the intended notion of zero boundary values.
