When can a set have an upper bound but no least upper bound?

$\sup S$ is shorthand for the least upper bound of $S$ in some set $T\supset S$ with respect to an order $\leq$ on $T$. However, we often omit $T$ and $\leq$ when they are obvious from the context.

Consider the case when $T=\mathbb{Q}$ and $\leq$ is the usual order. Since $\sup\left\{ x\in\mathbb{Q}:x^{2}<2\right\} $ has an upper bound but no least upper bound (in $T=\mathbb{Q}$), this supremum does not exist. Hence, $\mathbb{Q}$ does not satisfy the least upper bound property (a.k.a. Dedekind completeness).

However, if instead we had $T=\mathbb{R}$, the above supremum is $\sqrt{2}$.

Another example is given by @Hagen von Eitzen, where we look for $\sup \emptyset$. Regardless of whether $T=\mathbb{Q}$ or $T=\mathbb{R}$, in both of these spaces, $0$ is an upper bound of $\emptyset$. Furthermore, if $x$ is an upper bound of the empty set, so too is $x-1$. Therefore, there exists no least upper bound. We can write this as $\sup\emptyset = -\infty$ (in fact, if $T=\overline{\mathbb{R}}$, the extended reals with the obvious order, this is a precise statement).

Note that this does not contradict Dedekind completeness of the reals because Dedekind completeness only requires bounded nonempty sets to have supremums.