Let \(A\subseteq B \nsubseteq X\). The set \(A\) is dense in \(X\) if and only if \(A\) is dense in \(B\) and \(B\) is dense in \(X\).
Proof
Assume \(A\) is dense in \(B\) and \(B\) is dense in \(X\). Then
\[ X=\bar{B}=\overline{B\cap A}\subseteq \bar{B}\cap \bar{A}=X\cap \bar{A}. \]The other direction follows directly by definition.