The version of the Doob-Dynkin lemma given in my textbook is as follows:
Let $f: \Omega_1 \to \Omega_2$ be a function, let $\mathcal{F}$ be a $\sigma$-algebra on $\Omega_2$, and let $\sigma(f)$ be the $\sigma$-algebra on $\Omega_1$ generated by $f$. Denote the Borel $\sigma$-algebra on $\mathbb{R}$ by $B(\mathbb{R})$. Then, $h : (\Omega_1, \sigma(f)) \to (\mathbb{R}, B(\mathbb{R})) $ is measurable if and only if $h = g \circ f$ for some measurable function $g: (\Omega_2, \mathcal{F}) \to (\mathbb{R}, B(\mathbb{R})) $.
My textbook also states that this lemma fails if we replace $(\mathbb{R},B(\mathbb{R}))$ by some other measurable space, but does not provide an example of this failure. As such, I'm trying to come up with such an example on my own, but am not sure where to begin. Any help is appreciated!