Right, I skipped over the second line in your startpost, sorry about that. In fact, what you're trying to do has nothing to do with euler angles. What you need is a scale in an arbitrary direction. You can google for such a matrix setup, but I find it more interesting to investigate what you need to do, and devise a matrix out of that.
If you want to scale an arbitrary point p in direction n with scale s, where n is a unit vector, you need to form a new vector that is the projection of p onto the plane with normal n, and add to that the difference of the original vector and the new vector, multiplied by s.
In other words:
p' = p + (s-1)*dot(p, n)*n
p'.x = p.x + (s - 1) * (p.x * n.x + p.y * n.y + p.z * n.z) * n.x
p'.y = p.y + (s - 1) * (p.x * n.x + p.y * n.y + p.z * n.z) * n.y
p'.z = p.z + (s - 1) * (p.x * n.x + p.y * n.y + p.z * n.z) * n.z
Since for a matrix you need the form p'.x = a*p.x + b*p.y + c*p.z + d (a linear system of equations), you'll need to rewrite the above equations to get the values you put in your matrix.
p'.x = (n.x * n.x * (s-1) + 1)*p.x + (n.x * n.y * (s-1))*p.y + (n.x * n.z * (s-1))*p.z
p'.y = (n.y * n.x * (s-1))*p.x + (n.y * n.y * (s-1) + 1)*p.y + (n.y * n.z * (s-1))*p.z
p'.z = (n.z * n.x * (s-1))*p.x + (n.z * n.y * (s-1))*p.y + (n.z * n.z * (s-1) + 1)*p.z
Assuming D3D's system where vectors are row-matrices, you'll need to put the value (n.x * n.x * (s-1) + 1) at location (1, 1) (meaning row 1, column 1), (n.x * n.y * (s-1)) at (2, 1), etc..
To get what you need, simply take n as the normal of the plane you want it to be projected upon, and s=0 as you want to scale to zero in that direction. You might need a translation as well if your plane doesn't touch the origin.