Let $X = \Bbb{R}$ with the discrete metric. Is $X$ connected? No. Any nonempty subset $A ≠ X$ is open, as well as its complement. So $X$ is the union of disjoint nonempty open subsets.
Is there a more formal way of doing it?
Thanks for your help.

I think your answer is formal enough for any mathematical purpose, but if you want to go fancy you can try the following.
First, prove that a topological space $\,X\,$ is disconnected iff there exists a continuous and onto function $\,f:X\to \{0,1\}\,$ , where the latter space inherits its topology from the usual one on the reals (and, thus, it's a discrete space with two elements).
Now, for your case, show that $\,f:\mathbb{R}_{disc}\to \{0,1\}\,$ defined by $$f(x)=\left\{\begin{array}{ll} 0 \,&\,\text{if}\;x=0\\1\,&\,\text{if}\;x\neq 0\end{array}\right.$$is continuous and onto $\,\{0,1\}\,$...
