Definition of disconnected subsets in metric spaces and in more general settings I found the following paragraph in a Real Analysis book (namely, Carother's one).  

A subset $E$ of a metric space $M$ is disconnected in $E$ if there
  exist disjoint, nonempty, open (in $E$) sets $U$ and $V$ such that $E=
 U \cup V$. Now, it is immediate that this gives us a pair of open sets
  $A$ and $B$ in $M$ such that $U=A \cap E$ and $V = B \cap E$. And so
  "unrelating" the relative definition, by writing it in terms of $A$
  and $B$, yields: $A \cap E \neq \varnothing$, $B \cap E \neq
 \varnothing$, $(A \cap E) \cap (B \cap E) = \varnothing$, and $E = (A \cap E) \cup (B \cap E)$, or $E \subset A \cup B$.
  (Phew!) This mess would be greatly simplified if we could take $A$ and
  $B$ to be disjoint in $M$. While this need not hold true in more
  general settings, luck is with us in a metric space.

And then Carothers proceeds by giving the following lemma:

Let $E$ be a subset of a metric space $M$. If $U$ and $V$ are disjoint
  open sets in $E$, then there are disjoint open sets $A$ and $B$ in $M$
  such that $U = A \cap E$ and $V = B \cap E$.

I am wondering, what are the more general settings where this lemma does not hold?
 A: The discrete topology comes from a metric: $\rho(x,y) = 1$ if $x\neq y$ and $0$ if $x=y$.  So that won't work for your counterexample.  Instead, look for a small space with a small number of open sets. 
After a minute of playing around I found this: Let $X$ be the set $\{x,y,z\}$ with topology generated by the sub-basis $A=\{x,z\}$ and $B=\{y,z\}$.  So these are the only open sets: $\varnothing$, $\{x,y,z\}$, $\{x,z\}$, $\{y,z\}$, and $\{z\}$.  
Then $E = \{x,y\}$ is disconnected in $E$.  Using notation as in the definition, we let $U=\{x\}$ and $V=\{y\}$.  Since $U = A \cap E$ and $V = B \cap E$, $U$ and $V$ are open in $E$ (that is, open sets in the subspace topology of $E$).  Clearly $U \cup V=E$ and $U \cap V = \varnothing$.  
But there are no disjoint open sets in $X$ that separate $E$, as can be checked by experimenting on the five open sets.  
A: In general, a space $M$ is called completely normal if this lemma holds for all subsets of $M$.  A space $M$ is completely normal iff every subspace of $M$ is normal.  In particular, any non-normal space violates this lemma.  Explicitly, if $C$ and $D$ are disjoint closed sets in $M$ which cannot be separated by open sets, then you can take $E=C\cup D$, $U=C$, and $V=D$.
For an example of a very nice (in particular, compact Hausdorff) space in which the lemma fails, consider $M=(\omega_1+1)\times (\omega+1)$, where the ordinals $\omega_1+1$ and $\omega+1$ have the order topology (this space is known as the Tychonoff plank).  Then if $E=\{\omega_1\}\times\omega\cup\omega_1\times\{\omega\}$, the sets $U=\{\omega_1\}\times\omega$ and $V=\omega_1\times\{\omega\}$ are disjoint and open in $E$.  However, there do not exist disjoint open subsets $A,B\subseteq M$ such that $U=A\cap E$ and $V=B\cap E$.  Indeed, if $A$ is an open set containing all of $U$, then it must contain $(\alpha_n,\omega_1]\times\{n\}$ for $\alpha_n$ for each $n$, and therefore contains $(\alpha,\omega_1]\times\omega$ where $\alpha=\sup\alpha_n<\omega_1$.  Then for any $\beta>\alpha$, $A$ intersects every open neighborhood of the point $(\beta,\omega)\in V$, and in particular must intersect any open set containing $V$.
