There is a hypothesis left over here: the flow is irrotational, i.e. the so-called vorticity
$$\vec{\omega}=\nabla\times\vec{v}$$
is zero. As a result, the velocity field is a gradient,
$$\vec{v}=\nabla\phi,$$
for some scalar field $\phi$: the field appearing in the Bernoulli equation you quoted. Note that the right-hand side is not necessarily zero but it can be taken as a constant, which does not depend either on position or on time.
This is a simple consequence of (i) Euler equation for an incompressible fluid,
$$\frac{\partial\vec{v}}{\partial t} + (\vec{v}\cdot\nabla) v + \nabla\left(\frac{p}{\rho}+\psi\right)=0,$$
where $\psi=gh$ but it could be the potential for any other conservative force field; and (ii) the identity
$$\vec{v}\times\vec{\omega} = \nabla\left(\frac{v^2}{2}\right) - (\vec{v}\cdot\nabla) v.$$
Then Euler equation reads
$$\nabla\left(\frac{\partial\phi}{\partial t}+\frac{v^2}{2}+\frac{p}{\rho}+\psi\right)=0.$$
Therefore the term between parentheses is function of time only but we can absorb any time dependence into $\phi$, and therefore we end up with
$$\frac{\partial\phi}{\partial t}+\frac{v^2}{2}+\frac{p}{\rho}+\psi=C$$
where $C$ is constant over space and time. This is therefore a stronger result than the traditional Bernoulli theorem where the constancy is only along each streamline, with a priori a different constant for each streamline. Here the constancy is over the entire fluid.