Inverting the Gramian of a projected matrix I am stuck in the following argument with a mathematician that knows a billion things more than me related to matrix algebra.
I have a block matrix $D = [X\;\; W]$ of full column rank. I have another block matrix, $G = [X \;\;Z]$ where $Z$ has more columns than $W$. $G$ is of full column rank also. The row dimension is much higher than the column dimensions here, and everywhere the same.
Let $P_G = G(G'G)^{-1}G'$ be the orthogonal projection matrix related to $G$, and define
$$\hat D \equiv P_GD = [X \;\; P_GW]$$
The issue is the following: he insists that the matrix
$$\hat D' \hat D = D'P_GD$$
is not invertible "because there is a projection in the middle".
I would not hesitate to accept his knowledge, except for the fact that probably no less than tens of thousands of peer-reviewed theoretical and applied papers in Econometrics have been published using in theory and in empirical estimation matrices like $(\hat D' \hat D)^{-1}$ (and not as generalized inverses): this is essentially the set up for the so-called "Generalized Instrumental Variables Estimator".
I find very hard to believe that all these people and their reviewers were blind to the non-invertibility of this matrix, or that all these decades they were using generalized inverses and not one ever mentioned it.  
Can somebody explain what is the basis of the mathematician's argument, and where/how he ends up misapplying it? Or explain why he is right after all? References so I could study the issue myself would also be useful.

Your friend is wrong. I guess he is not paying attention to the sizes of the matrices. The point is that $P_G$ is a big square matrix, while $D$ is rectangular, with less columns than rows. 
Here is an example "with a projection in the middle" such that the product is invertible. If $$ D=\begin{bmatrix}1\\0\end{bmatrix},\ \ \ P_G=\begin{bmatrix}1&0\\0&0\end{bmatrix}.$$
Then
$$
D'P_GD=\begin{bmatrix}1&0\end{bmatrix}\,\begin{bmatrix}1&0\\0&0\end{bmatrix}\,\begin{bmatrix}1\\0\end{bmatrix}=\begin{bmatrix}1\end{bmatrix},
$$
which is invertible. 
If $D$ and $P_G$ were square matrices, then what your friend says applies, and $D'P_GD$ cannot be invertible. 
