Prove that $(X\times Y)\setminus (A\times B)$ is connected
Solution 1:
We can simplify Davide Giraudo's answer by noting that we only need to show that $(a,b)$ is in the same connected component as every other point.
So, start by fixing $a \in X \setminus A$ and $b \in Y \setminus B$ as Davide does, and consider an arbitrary point $(x,y) \in (X \times Y) \setminus (A \times B)$.
If $x \notin A$, then $\{x\} \times Y$ is connected and contains both $(x,y)$ and $(x,b)$, while $X \times \{b\}$ is connected and contains both $(x,b)$ and $(a,b)$. Thus, $(\{x\} \times Y) \cup (X \times \{b\})$ is connected and contains both $(x,y)$ and $(a,b)$.
Otherwise, $x \in A \implies y \notin B$. Thus, analogously, $X \times \{y\}$ is connected and contains both $(x,y)$ and $(a,y)$, while $\{a\} \times Y$ is connected and contains both $(a,y)$ and $(a,b)$, and so $(X \times \{y\}) \cup (\{a\} \times Y)$ is connected and contains both $(x,y)$ and $(a,b)$.
Solution 2:
Let $(x_1,y_1)$ and $(x_2,y_2)\in (X\times Y)\setminus (A\times B)$. We will prove that these points are in the same connected component. Fix $a\in X\setminus A$ and $b\in Y\setminus B$.
First case: $x_1\notin A$ and $x_2\notin A$. Then $\{x_1\}\times Y$ is connected. So is $X\times \{b\}$ and $\{x_2\}\times Y$. Take $C_1:=\{x_1\}\times Y$, $C_2:=X\times\{b\}$ and $C_3:=\{x_2\}\times Y$. These three sets are connected and $C_1\cap C_2$, $C_2\cap C_3$ are non-empty so $C_1\cup C_2\cup C_3$ is connected and lies in $(X\times Y)\setminus (A\times B)$.
Second case: $x_1\notin A$ and $y_2\notin B$. Take $C_1:=\{x_1\}\times Y$, $C_2:=X\times \{y_2\}$ and $C_3:=\{x_2\}\times Y$.
The other cases are similar.