Example of a metric space where Heine-Borel theorem does not hold

Consider $\Bbb R^2 \setminus \{(0,0)\}$ with the usual metric restricted from $\Bbb R^2$. The set $$D = \{ (x,y) \in \Bbb R^2 \mid 0 < x^2+y^2 \leq 1 \}$$is closed in $\Bbb R^2 \setminus \{(0,0)\}$, bounded, but not compact. Sequences in $D$ which "want" to converge to $(0,0)$ don't have limit in $D$.


Any non-complete metric space, or an infinite-dimensional Banach space.


Motivated by a comment on another answer, here goes another example (which avoids the psychologically problematical "non-complete" case, while being elementary):

Let $(M,d)$ be an infinite set with the discrete metric. $M$ is then bounded, obviously closed as a subset of itself, but is not compact (the cover $\{x\}_{x \in M}$ is an open cover with no finite subcover). Note that $M$ is also complete.