En general se puede escribir la matriz de proyección muy fácilmente mediante una arbitraria base para el subespacio. Mira este.
Así que para su caso, en primer lugar encontrar una base para el avión;
$$x-y-z=0\Longrightarrow x=y+z$$
$$\{\begin{bmatrix}
1\\ 1\\ 0\end{bmatrix},\begin{bmatrix}
1\\ 0\\ 1\end{bmatrix}\}$$
Now let $Una:=\begin{bmatrix}
1 & 1\\
1 & 0\\
0 & 1\end{bmatrix}$, your projection matrix is $A(A^tA)^t$. De la computación por la mano no es difícil, pero yo prefiero poner el Arce de cálculo para usted aquí;
A := Matrix([[1, 1], [1, 0], [0, 1]]);
P := A.MatrixInverse(Transpose(A).A).Transpose(A);
El resultado es;
$$\begin{bmatrix}
\frac{2}{3} & \frac{1}{3} & \frac{1}{3}\\
\frac{1}{3} & \frac{2}{3} & -\frac{1}{3}\\
\frac{1}{3} & -\frac{1}{3} & \frac{2}{3}\end{bmatrix}$$
Now the matrix you showed at the end of your question. If you extend an arbitrary basis of $W$ which of course it has 2 elements, to a basis for $\mathbb{R}^3$ and then indexing these three vectors in the way that the new added vector be the first then representation of $P$ in this new ordered basis is $\begin{bmatrix}0 & 0 & 0\\ 0 & 1 & 0\\ 0 & 0 & 1\end{bmatrix}$ because say $B:=\{v_1,v_2,v_3\}$ be this ordered basis then basis of $W$ is $\{v_2,v_3\}$en la nueva coordinar;
$$v_2=0v_1+1v_2+0v_3\longrightarrow v_2=\begin{bmatrix}0\\ 1\\ 0\end{bmatrix}$$
$$v_2=0v_1+0v_2+1v_3\longrightarrow v_2=\begin{bmatrix}0\\ 0\\ 1\end{bmatrix}$$
Ahora dejando $A:=\begin{bmatrix}
0 & 0\\
1 & 0\\
0 & 1\end{bmatrix}$ Tenemos;
A := Matrix([[0, 0], [1, 0], [0, 1]]);
P := A.MatrixInverse(Transpose(A).A).Transpose(A);
El resultado es;
$$\begin{bmatrix}
0 & 0 & 0\\
0 & 1 & 0\\
0 & 0 & 1\end{bmatrix}$$
But pay attention this representation of $P$ is not in the standard coordinate, it is in the new coordinate system given by the ordered basis $B$.