Why are EM waves transverse?
Let's take a slightly more general case: Consider a wave with wave vector $\vec k=(k_x,k_y,k_z)$, with the electric field given by $$\vec E=\vec E_0\ e^{i(\vec k \cdot \vec r-\omega t)} $$ where $\vec r=(x,y,z)$. Now, we want to satisfy Maxwell's equations in the vacuum, including Gauss' law: $$\vec \nabla \cdot \vec E=0$$ The derivative is quite easily evaluated explicitly $$ \vec \nabla\cdot \vec E=\vec \nabla \cdot \bigl(\vec E_0\ e^{i(\vec k \cdot \vec r-\omega t)}\bigr)=i\vec k \cdot \vec E_0 e^{i(\vec k \cdot \vec r -\omega t)} $$
In order to satisfy Gauss' law, we must impose: $$\vec k \cdot \vec E_0=\ \text{?}$$
Physically, this means that the direction of propagation is always $\dots$ to the electric field. The exact same argument applies for the $\vec B$-field.
I leave it as an exercise to the reader to convince him(/her/it)self that the question as originally posed is equivalent, i.e. that we can assume without loss of generality that $\vec k = (0,0,k_z)$, resulting in the conclusion reached by Griffiths.
In this answer, I'll start with a real expression for $E$, because I think the exposition is clearer. There is no loss of generality in doing that, because the real expression will always be equivalent to the real part of the complex version of $E$, for some appropriate choice of the origin. Thus, my starting point is
$$E(z,t)=E_0\ sin(k z-\omega t)\ .$$
Since $E$ doesn't depend on $x$ or $y$, clearly $\partial E/\partial x=0$ and $\partial E/\partial y=0$, so the only way that the condition $\nabla \cdot E=0$ can always hold is if $\partial E_z/\partial z=0$ always holds, i.e.,
$$0=\frac{\partial E_z}{\partial z}=(E_0)_z\ k \cos(k z-\omega t)\ .$$
The only way for that equation to hold for all $z$ and all $t$ is if either $(E_0)_z=0$, or $k=0$. If $(E_0)_z=0$, that was the thing to be proved, so we'd be done. The alternative of $k=0$ means that $E$ can be expressed as
$$E=E_0 \sin(-\omega t)\ .$$
Given that there's no current involved, the Ampere-Maxwell equation reduces to just
$$\nabla \times B=\mu_0 \epsilon_0 \frac{\partial E}{\partial t}\ .$$
But
$$(\nabla \times B)_z=\frac{\partial B_y}{\partial x}-\frac{\partial B_x}{\partial y}=0, $$
so the $z$ component of the Ampere-Maxwell equation implies that
$$0=\frac{\partial E_z}{\partial t}=-(E_0)_z\ \omega \cos(-\omega t)\ .$$
The only way that that condition will hold for all $t$ is if either $(E_0)_z=0$, in which case we're done, or $\omega=0$. But if $\omega=0$, that means that simply
$$E_z=(E_0)_z$$
for some constant $(E_0)_z$, i.e., a non-zero $(E_0)_z$ would at most superimpose a constant additional field on top of the wave. Furthermore, the boundary conditions would be a problem with a non-zero $(E_0)_z$, because integrating $E$ along the $z$ axis would result in an arbitrarily large electric potential difference. So the only physically reasonable possibility is $(E_0)_z=0$.
The derivation of $(B_0)_z=0$ is very nearly the same, but with $E$ and $B$ transposed, and with a different sign or constant in a couple places.