I know that there is a function $u\in B^n(0,1)$ s.t. $u$ is unbounded on every open set of $B^n(0, 1)$. The usual approach is to pick a countable dense set $\{q_n\}\subset B^n(0, 1)$ and set $$u(x)=\sum_{n=1}^{\infty}\frac{|x-q_n|^{\alpha}}{2^n} $$ for a suitable exponent $\alpha$, because we know that the function $v(x)=|x|^{\alpha}$ is in $W^{1, p}(B^n(0, 1))$ iff $\alpha=0$ or $\alpha >1-n/p$.
My question is: Can I extend this example to the whole $\mathbb{R}^n$, because it is also separable? The problem is that the component functions of $u$ are no longer integrable over $\mathbb{R}^n$. So I was considering cut functions $f_n\in C^{\infty}_0(B(q_n, r_n))$ so that $f_n|_{B(q_n, r_n/2)}=1$ and $0≤f_n≤1$. But now I'm struggling with the choice of radius $r_n$ such that the integrals of component functions would be independent of $n$ or would contribute in a way that the series converges. Also I'm not sure why I can differentiate the series term by term, because the convergence is not necessarily uniform. Or does this follow from Dominated Convergence?
Is my approach correct or am I missing something?
You could multiply the elements in the sequence by a cut-off function $\psi\in C_c^\infty( B_2(0))$, $\psi\ge0$, $\psi=1$ on $B(1,0)$. Then define $$ u(x):=\sum_{n=1}^\infty \frac1{2^n} \psi(x-q_n) |x-q_n|^\alpha. $$ In this way, the elements in the sequence have compact support, are in $W^{1,p}(\mathbb R^d)$, and the series converges.