Proving a convex space is connected

Assume a decomposition $C= A \cup B$ exists as you have described. Define $f:C \to \Bbb R$ via $f(x) = 0~ \forall x \in A$ and $f(x)=1~ \forall x \in B$. Then $f:C \to \Bbb R$ is continuous. Define $g:[0, 1] \to C$ via $g(t)=tx_1+(1-t)x_2.$ Then $g$ is continuous, so $f \circ g:[0, 1] \to \Bbb R$ is also continuous. But $f \circ g$ must be discontinuous because (among other things) it violates the Intermediate Value Theorem: $f \circ g(0)=0, f \circ g(1)=1, \forall t \in (0, 1)~ f \circ g(t) \neq \frac{1}{2}.$ That's a contradiction, so there can be no such decomposition of $C$.

Edited to add:

To see that $f$ is continuous, choose $x \in C$. Then $x \in A$ or $x \in B$. Let's assume $x \in A$. Because $A$ is open, there exists an open ball $U$ around $x$ such that $U \subseteq A$. Then $\forall \epsilon \gt 0 \forall y \in U, |f(y)-f(x)| = 0 \lt \epsilon$, so $f$ is continuous at $x$. But $x$ is arbitrary, so $f$ is continuous throughout $C$.