In order to show that a metric space $(X, d)$ is not complete one may apply the definition and look for a Cauchy sequence $\{x_n\}\subset X$ which does not converge with respect to the metric $d$. Now I have often seen (on books, e.g.) another approach: one may show that a sequence $\{x_n\}\subset X$ converges with respect to the metric $d$ to a limit $x$ which is not contained in $X$.
A common example may be the following: since $x_n:= (1+1/n)^n\in \mathbb{Q}$ for every $n \in \mathbb{N}$ and $x_n \to e$, but $e \notin \mathbb{Q}$, one can conclude that $\mathbb{Q}$ is not complete.
I've always considered this to be obvious but I now realize I can't explain why this works. The quantity $d(x_n, x)$ itself need not be well-defined, in general, if $x \notin X$. So my question is: why (and under which conditions) this criterion for not-completeness of a metric space ("limit is not in the same space as the sequence") can be used?
It can be used when you are aware of the existence of a metric space $(Y,d^\ast)$ such that:
In the example that you have mentioned, that space is $\mathbb R$, endowed with its usual metric.
Actually, such a metric space always exist (take the completion of $X$, for instance), but if you don't know how to work with it, that's a useless piece of information.