Your example isn't quite right: $\dfrac 1{\sqrt x}$ isn't square integrable on either $(0,1]$ or on $[1,\infty)$.
There are a few ways to proceed. For $a > 0$ define $f_a(x) = \dfrac 1{x^a} \chi_{[1,\infty)}(x)$. It is well-known that $f_a$ is integrable on $\mathbb R$ if and only if $a > 1$ and consequently $f_a \in L^2(\mathbb R)$ if and only if $a > \frac 12$. Define
$$f = \sum_{n=1}^\infty \frac{1}{2^n} \frac{f_{\frac 12 + \frac 1n}}{\|f_{\frac 12 + \frac 1n}\|_{L^2}}$$
so that $f \in L^2(\mathbb R)$. If $0 < p < 2$ then for sufficiently large $n$ you have $p \left( \frac 12 + \frac 1n \right) < 1$ which means that $f_{\frac 12 + \frac 1n} \notin L^p(\mathbb R)$. Consequently (since every function in the sum is positive) you have $f \notin L^p(\mathbb R)$ for all $0 < p < 2$.
You can do a similar construction with functions of the form $g_a(x) = \dfrac 1{x^a} \chi_{(0,1)}(x)$ to construct a function $g \in L^2(\mathbb R)$ with the property that $g \notin L^p(\mathbb R)$ for all $p$ with $2 < p < \infty$.
The function $f+g$ gives you a function in $L^2(\mathbb R)$ that belongs to no other $L^p$ space.