How do you define the "boundary" of a topological space? As described here (and as I always thought was the most general definition of boundary), a possible definition of the boundary of a subset $S$ of a topological space $X$ is $\partial S = \overline S \backslash \mathrm{int}(S)$. 
I am reading Allen Hatcher's book on algebraic topology, and they often refer to "the" boundary of a topological space, for instance by saying that $\partial D^2 = S^1$. How is this notion of boundary uniquely defined? Because if I take an injection of $D^2$ into $\mathbb R^2$, I'm going to get $S^1$, but if I take the injection of $D^2$ into $\mathbb R^3$, then $D^2$ becomes its own boundary. I know that the $\partial$ is an important operation in topology so I'm trying to figure it out, and I feel like it doesn't quite make sense here. 
So can anyone describe precisely what is meant by $\partial X$ when $X$ is a topological space? Or at least explain what is meant by that in particular contexts where it is used.
 A: The concept of boundary can be extended to the (regular) CW-complexes, as suggested here.  
The boundary of a (regular) CW-complex $X$ is :  $$\partial X := \overline{\bigcup_{n \ge 0}(\bigcup_{c \in \text{n-cells}} \partial c) / (\bigcup_{c \ne c'\in \text{n-cells}} (\partial c \cap \partial c'))}$$    
Definition : The notation "$n$-cells" above, is the set of closed $n$-cells.     

Example : Let $X$ be a topological space with the following simplicial complex structure :
 
All the sets : 


*

*$0$-cells $=\{ A,B,C,D,E,F \}$ 

*$1$-cells $=\{ [A,B],[B,C],[C,D], [D,E],[E,A],[A,F]...  \}$

*$2$-cells $=\{ [A,B,F],[B,C,F],[C,D,F], [D,E,F],[E,A,F]\}$  


Now :  


*

*$\partial A = \partial B = ... = \partial F = \emptyset$   

*$\partial [A,B] = \{A,B \}$ , $\partial [B,C] = \{B,C \}$ , ....

*$\partial [A,B,F] = [A,B] \cup [B,F] \cup [A,F] $, $\partial [B,C,F] = [B,C] \cup [C,F] \cup [B,F] $, ...    


So :  


*

*$(\bigcup_{c \in \text{0-cells}} \partial c) / (\bigcup_{c \ne c'\in \text{0-cells}} (\partial c \cap \partial c')) = \emptyset$  

*$(\bigcup_{c \in \text{1-cells}} \partial c) / (\bigcup_{c \ne c'\in \text{1-cells}} (\partial c \cap \partial c')) = \emptyset$  

*$(\bigcup_{c \in \text{2-cells}} \partial c) / (\bigcup_{c \ne c'\in \text{2-cells}} (\partial c \cap \partial c')) = (A,B) \cup (B,C) \cup (C,D) \cup (D,E) \cup (E,A)$  


Conclusion : $\partial X = [A,B] \cup [B,C] \cup [C,D] \cup [D,E] \cup [E,A]$   

Questions : Let $X$ be a topological space admitting a (regular) CW-complex structure :       


*

*Does $\partial X$ depend on the choice (regular) CW-complex structure ?

*Can we extend this definition for all the topological spaces ?

A: The notion of boundary that you are looking for comes from the definition of topological manifolds with boundary. As opposed to a regular manifold $X$, a manifold with boundary has the property that each point in $X$ has an open neighborhood which is homeomorphic to an open set in the euclidean half space $\mathbb{R}_+^n=\{(x_1,\dots,x_n)\in\mathbb{R^n}:x_n\ge0\}$. Thus we then define $\partial X$ to be the points which when mapped to $\mathbb{R}_+^n$ have $x_n=0$.
This definition has the benefit that an embedding of $X$ into some other space does not change $\partial X$. Thus $\partial D^2=S^1$ irregardless of whether you view it as living in $\mathbb{R}^2$ or in $\mathbb{R}^3$.
