Why is the set $\{x \mid f(x) \not= g(x)\}$ measurable in a topological hausdorff space? assuming i have a measure space $(X, \mathscr{M}_X, \mu)$ and a measurable space $(Y,\mathscr{M}_Y)$, two measurable mappings $f,g:X \to Y$ and it holds that $Y$ is a topological hausdorff space with a countable base. (I think i am supposed to assume that $\mathscr{M}_Y$ is the Borel-$\sigma$-Algebra generated by the open/closed subsets of Y)
Now i am wonderung: Why exactly is the set $\{x \in X \mid f(x) \not= g(x)\}$ measurable? in other words why is $$\{x \in X \mid f(x) \not= g(x)\} \in \mathscr{M}_X$$
I know that the diagonal $\Delta Y = \{(y,y)\mid y \in Y\}\subset Y \times Y$ is closed in any hausdorff space.
I also know that since $\Delta Y$ is closed in $Y \times Y$, its complement $(Y \times Y)\setminus \Delta Y$ is open. 
However, $\{(f(x),g(x)\mid x \in X,  f(x) \not= g(x) \}$ is only a subset of $(Y \times Y)\setminus \Delta Y$ for which i can't say whether it is open or closed.
The only idea that's left was to try this:
Pick an arbitrary point $p = (f(x),g(x))$ for which $f(x)\not= g(x)$ in $Y\times Y$. Since $Y$ is a Hausdorff space, we can find disjoint open neighbourhoods $U$ around $f(x)$ and $V$ around $g(x)$ such that $U \times V$ is an open neighbourhood of $(f(x),g(x))$ with $$U \times V \cap \Delta Y = \emptyset$$
Since $\{(f(x),g(x)\mid x \in X, f(x) \not= g(x) \}$ is a union of all such open neighbourhoods $U\times V$ of points $(f(x),g(x))$ with $f(x) \not= g(x)$ it is open in $Y\times Y$.
(is this correct?)
If the last paragraph would be correct, i'd be finished.
Thank you very much for any of your help.
EDIT: New summary of what i gathered so far with the help of the recent comments and answers:
As pointed out in the comments, i did the mistake to purely focus on $$B:= \{(f(x),g(x)\mid f(x) \not= g(x), x \in X\}$$ and tried to conclude that its preimage is measurable iff $B$ is open which was a wrong assumption in the first place. 
Therefore, i do not need $B$ itself to be open. It's sufficient to show that the union of all open disjoint neighbourhoods $U\times V$ of arbitrary points $f(x),g(x)$ for which $f(x) \not= g(x)$ is an open set; because what matters is its preimage and not the set (image) itself. Let $$ B' := \bigcup\{U \times V \mid U, V \in \mathcal{B}\ ;\ U \cap V = \emptyset\}$$
$B'$ is obviously an open set, therefore its preimage is mesaurable.
For the preimage of open disjoint neighbourhoods $U,V$ of $f(x)$ and $g(x)$ respectively, it holds that
$$(f\times g)^{-1}(U\times V) = \{x \mid f(x)\in U \wedge g(x) \in V\} = f^{-1}(U)\cap g^{-1}(V)$$ (this is something i actually didnt know, it didn't know the definition of cartesian products of mappings, that's also the reason i didnt understand alex's question right away)
Since $U\times V$ is open, $(f\times g)^{-1}(U \times V)$ is measurable. Since $\mathcal{B}$ is a countable base the set 
$$\{x \in X\mid f(x) \not= g(x) \} = \bigcup \{ (f\times g)^{-1}(U\times V) \mid U, V \in \mathcal{B}, U \cap V = \emptyset\} = \bigcup\{ f^{-1}(U)\cap g^{-1}(V)\mid U, V \in \mathcal{B}, U \cap V = \emptyset\}$$ is a countable union of measurable sets and therefore measurable itself.
 A: $h(x)=(f(x),g(x))$ is measurable and $\{x:f(x)\neq g(x)\}=h^{-1}(Y\times Y-\Delta)$ is measurable since $\Delta$ is closed, $(Y\times Y)-\Delta$ is open.
A: I think all presented proofs are incomplete (for instance, they don’t use the fact that $Y$ has a countable base $\mathcal B$).  I also assume that $\mathcal M_X$ is closed with respect to intersections and countable unions. 
Let $A=\{x\in X|f(x)\ne g(x)\}$. Let $x\in A$ be any point. Since $f(x)\ne g(x)$ and $Y$ is Hausdorff, there exists disjoint neighborhoods $U,V\in\mathcal B$ of $f(x)$ and $g(x)$, respectively. Thus 
$$A=\bigcup \{f^{-1}(U)\cap g^{-1}(V): U,V\in\mathcal B, U\cap V=\varnothing\}$$
is measurable.
A: In answer to the question asked, about whether the argument in the last paragraph is correct, I don't believe that it is at it stands.
The problem is with the assertion $"\ \{(
\,f(x),g(x)\ )\mid x \in X, f(x) \not= g(x) \}\ $ is a union of all such open neighbourhoods $ \dots\ $ ."  If you take the union of all the open neighbourhoods you describe you will certainly get an open set containing $\ \{(
\,f(x),g(x)\ )\mid x \in X,\, f(x) \not= g(x) \}\ $, but I don't see why it should be equal to it, and I believe I can give a counterexample to the general statement that $\ \{(
\,f(x),g(x)\ )\mid x \in X,\, f(x) \not= g(x) \}\ $ must be open under the hypotheses given
Nevertheless, I think Alex Ravsky's proof shows that the basic idea underlying the argument was sound.
Addendum: It may be helpful for me to add one of the counterexamples I was referring to in my above comments.
Take $\ X = Y = \mathbb R\ $—the set of real numbers—, and $\ \mathscr{M}_X ,\mathscr{M}_Y\ \ $ both to be the Borel sets of $\ \mathbb R\ $.  Let $\ f\left(x\right)= 0\ \mbox{ and }\ g\left(x\right)= x\ \mbox{ for all } x\in\mathbb R\ $. Then $\ \{(
\,f(x),g(x)\ )\mid x \in X,\, f(x) \not= g(x) \}\ $ is the punctured line segment $\ \left\{\ \left(\,0,x\,\right)\ \mid\  x\ne0\ \right\}\ $ of $\ \mathbb R^2\ $, which is not an open set.
Comment on proposed new proof:
Apart from some probable typos, itemised below, the new revised proof by Zest seems to me to be correct.
The following appear likely to me to be typos:


*

*$$B' = \bigcup \left\{ U\times V\mid U,V\in B,  U\cap V=\emptyset\right\}\ .$$
This should be
$$B' = \bigcup \left\{ U\times V\mid U,V\in{\mathcal B},  U\cap V=\emptyset\right\}$$

*I'm not sure what the observation "Since $\ B\ $ is a countable base $\ \mathcal B\ \dots\ $" is trying to say.  As far as I can see, all that's necessary here is the observation that $\ \mathcal B\ $ is a countable base.

*A union sign is missing from the last term on the left of the final series of equations. That is, $\ \left\{\,f^{-1}\left(U\right)\cap g^{-1}\left(V\right)\mid U,V\in{\mathcal B},  U\cap V=\emptyset\right\}\ $ should be $\ \bigcup\left\{\,f^{-1}\left(U\right)\cap g^{-1}\left(V\right)\mid U,V\in{\mathcal B},  U\cap V=\emptyset\right\}\ $
The nice observation Alex Ravsky and Zest have made here, and which I had missed, is that $\ \left\{\,x\in X \mid f\left(x\right)\neq g\left(x\right)\,\right\}\ $ is actually equal to $\ \left(f\times g\right)^{-1}\left(B'\right)\ $ rather than being a strict subset of it. Since this isn't immediately obvious—at least it wasn't to me, although the proof is fairly straightforward once the fact is realised—I'd like to see a brief proof of that fact included in any formal writeup.
