Isomorphism between homology groups if we throw away some submanifold from the interior Suppose $M$ is a compact manifold with boundary and $D$ is a compact surface with boundary such that$\partial D\subset \partial M$. Why is the map $H_1(M\setminus D)\rightarrow H_1(M)$ an isomorphism when the codimension of $D$ is 3 or more? If the codimension is 2, is the result false? Is there any reference for this kind of statement ?
 A: This answer considers only the case $\partial M= \emptyset$.
First off, notice that taking $D$ as the north and south pole of $M=S^2$ gives an example for the result failing in the case of codimension $2$. 
Now, proceeding to a proof: we have an isomorphism $H_1(M \backslash D) \to H^{n-1}(M,D)$ due to Poincaré-Alexander-Lefschetz duality. 
The exact sequence in cohomology for the pair $(M,D)$ yields
$$\cdots \to H^{n-2}(D) \to H^{n-1}(M,D) \to H^{n-1}(M) \to H^{n-1}(D) \to \cdots $$
It follows that if $H^{n-2}(D)=0$ and $H^{n-1}(D)=0$, then $H^{n-1}(M,D) \to H^{n-1}(M)$ is an isomorphism. Here it is worth noticing that this is the case when $D$ has codimension $3$ or more, since then $n-2>\dim D$. Now, following back through the duality isomorphism $H^{n-1}(M) \to H_1(M)$, we have the composition
$$H_1(M \backslash D) \to H^{n-1}(M,D) \to H^{n-1}(M) \to H_1(M).$$
It suffices  now to see that the diagram
$$\begin{array}{ccccccccc} H^{n-1}(M,D) & \xrightarrow{} & H^{n-1}(M)\\
\uparrow & & \downarrow & \\
H_1(M \backslash D) & \xrightarrow{} & H_1(M) \end{array}$$
commutes, where the path $up \rightarrow right \rightarrow down$ is the aforementioned chain of isomorphisms, and the map on the bottom is the map you mention in your post. But this follows from the definition of the duality map and the fact that the top and bottom arrows are the ones induced by inclusions.
