EDIT. There is an easy partial answer and a much more clever full answer, due to Anthony Carapetis.
Easy partial answer
Assuming that $q\in N\subset f^{-1}\{b\}$ and that $N$ is a smooth submanifold of $M$,
then
$\mathrm{Hess}_q(f)(v, w)=0$ for all $v, w\in T_q N$.
Why partial? Because this gives no information on $\mathrm{Hess}_q(f)(v, w)$ for $v\in T_qN$ and general $w\in T_qM$.
Proof.
If $\gamma$ is a curve passing through $q$ (i.e. $\gamma(0)=q$) and contained in $N\subset f^{-1}\{b\}$, then
$$f(\gamma(t))=b, \qquad \forall t, $$
and differentiating this relation twice we obtain
$$\mathrm{Hess}_{\gamma(t)}\, f(\dot{\gamma}(t), \dot{\gamma}(t)) + df(\gamma(t)) \ddot{\gamma}(t)=0.$$
Evaluating at $t=0$, using that $df(\gamma(0))=0$, this yields
$$\mathrm{Hess}_{q}\, f(\dot{\gamma}(0), \dot{\gamma}(0))=0.$$
Since $\gamma$ was an arbitrary curve on $N$, this last equation shows that $\mathrm{Hess}_q\, f(v, v)=0$ for all $v\in T_qN$.
This is enough to conclude, because $\mathrm{Hess}_q\, f$ is a symmetric operator. Indeed, if $H\colon V\times V\to \mathbb R$ is a symmetric bilinear operator on a real vector space $V$, then $H(v, v)=0$ for all $v\in V$ implies that $H(v, w)=0$ for all $v, w\in V$, because of the polarization identity.
Full answer
Assuming that there exists an open set $U\subset M$ such that $q\in U$ and $$N=U\cap f^{-1}\{b\}\quad \text{is a smooth submanifold of }M, $$
then
$\mathrm{Hess}_q(f)(v, w)=0$ for all $v\in T_q N$ and $w\in T_q M$.
Proof. This is Anthony's answer.
Remark. The main difference is in the result, which is stronger, because only one of the vectors is tangent to the level set $f^{-1}\{b\}$. The assumption is also slightly stronger, as it is assumed that the full level set has the structure of a submanifold (locally at least). In the easy case we merely assume that the level set contains a submanifold.
This is necessary to rule out the case of $f(x, y)=xy$. The origin of $\mathbb R^2$ is a critical point for $f$. The level set $f^{-1}\{0\}$ is not a submanifold in any neighborhood of the origin, due to self-intersection. We could consider the submanifold $N=\{(x, y)\in \mathbb R^2\ :\ y=0\}$, but then the result of the "Full answer" is false, as
$$\mathrm{Hess}_{(0,0)} f( (1,0), (0,1) ) =1\ne 0, $$
even if $(1, 0)\in T_{(0,0)} N$.
$ Ker(Q)={v \in V|Q(v,w)=0,\ \forall w \in V}. $
– Majid Oct 27 '17 at 20:54