Set $X=D,Y=D\setminus D',n=\dim D$. I presume you are interested in real algebraic curves (in the complex case everything simplifies). The problem is that $X\setminus Y$ is not smooth. But there is an ad hoc way to handle this. Let us triangulate $X$ so that $Y$ is a subcomplex. Assume that $H_n(X,\mathbb{Z}/2)=\mathbb{Z}/2$ and that $X$ is compact. (Actually, in the real case there are two possible definitions of smoothness: given a plane real curve, one may require that the corresponding complex curve is smooth or that it has no real singularities so depending on the definition of $D$ these assumptions may or may not be true.) The "fundamental class" of $X$ mod 2 is represented in the simplicial chain group by the sum of all the simplices: if we take a combination of all simplices but one, it will come from a subcomplex homotopy equivalent to something of dimension $< n$. So each $n-1$-simplex is in the boundary of an even number of $n$-simplices.

So the relative homology group $H_n(X,Y)$ is freely generated by the sums $\sum_{Int(\sigma)\subset C}\sigma$ where $C$ is a component of $X\setminus Y$ and $Int$ denotes the interior. There is one such element for each component, which proves the isomorphism in the original posting.

Remarks:

This does not generalize to higher (co)homology or to other coefficients. The general Alexander duality theorem is the following statement: suppose $X\supset Y$ is a pair of nice spaces (say, the one point compactification of $X$ can be made into a CW-complex so that the closure of $Y$ is a subcomplex) such that $X\setminus Y$ is a manifold. Let's assume it orientable. Then $$H^{BM}_*(X,Y)\cong H^{BM}_*(X\setminus Y)\cong H^{n-*}(X\setminus Y)$$
where $d$ is the real dimension of $X$, $H^{BM}$ denotes the Borel-Moore homology (it coincides with the usual homology for compact spaces) and the second isomorphism is the Poincar\'e-Lefschetz duality. So $H^0(X\setminus Y)\cong H_n^{BM}(X,Y)$. Assuming that in addition to the above $H^{BM}_{n-1-i}(X)=H_{n-i}^{BM}(X)=0$ we get $H^i(X\setminus Y)\cong H_{n-1-i}^{BM}(Y)$ from the long exact sequence for the Borel-Moore homology. In the case $X=\mathbb{R}^n$ we get the usual Alexander duality; for $i=0$ these assumptions are not quite satisfied: $H^{BM}_n(\mathbb{R}^n)=\mathbb{Z}$, so we get an exact sequence $$0\to \mathbb{Z}\to H_n^{BM}(X,Y)\to H^{BM}_{n-1}(Y)\to 0$$ instead.

There is a duality theory for singular spaces called the Verdier duality. Informally, it says the following. Let $X$ be a nice space (e.g. a finite CW complex) and $A$ a commutative ring. Let $D^b(X)$ be the derived category of the category of complexes of sheaves of $A$-modules on $X$ whose cohomology sheaves are constructible with respect to some stratification. Then there is an anti-autoequivalence $F\mapsto F^\vee$ of $D^b(X)$ such that $H^*(X,F)\cong H^{-*}(X,F^\vee)$ where $H^i(X,F)$ denotes $\mathop{\mathrm{Hom}}\nolimits_{D^b(X)}(\underline{A},F[i])$, $\underline{A}$ being the constant sheaf with stalk $A$. If $X$ is an orientable manifold (in the usual sense), $\underline{A}^\vee$ is again constant (up to a shift), which gives one the usual Poincar\'e duality, but in general $\underline{A}^\vee$ needn't even be a sheaf (it may have "components" in different degrees).

sphere. From this, is it possible to derive the version mentioned in the question, which applies to the pair of the discriminant and a subspace? – user1289492 Jul 12 '13 at 6:14