To derive the Bernoulli equation for inviscid fluids, the plan is to rewrite the Euler equation in such a way that we have gradients. I'll write the Euler equation with gravity here
$$\frac{\partial \vec{u}}{\partial t} + \vec{u} \cdot \vec{\nabla} \vec{u} = -\frac{1}{\rho} \vec{\nabla} p + \vec{g}.$$
Recall $g = - \vec{\nabla} \Psi$, and $\vec{u} \cdot \vec{\nabla} \vec{u} = \vec{\nabla}(\frac{1}{2} \vec{u}^2) - \vec{u} \times (\vec{\nabla} \times \vec{u})$. Now we also consider a steady flow, $\frac{\partial}{\partial t} \rightarrow 0$. Note, you can consider non-steady if you have potential flows, i.e., $\vec{\nabla} \times \vec{u} = 0 \rightarrow \vec{u} = \vec{\nabla}\phi$ (a gradient appears). Now you look at quantities along flow lines, i.e., dot the equation with $\vec{u}$, this returns
$$ \vec{u} \cdot \vec{\nabla} \left(\frac{1}{2} \vec{u}^2 + \Psi\right) = \vec{u} \cdot \left( -\frac{1}{\rho} \vec{\nabla} p\right).$$
Note that $\vec{u} \cdot (\vec{u} \times \vec{A}) = 0$, for any $\vec{A}$, including $\vec{A} = \vec{\nabla} \times \vec{u}$. Now we'd like to put that density inside that gradient so that we can have $\vec{u} \cdot \vec{\nabla}(\textrm{stuff}) = 0$, then ``stuff'' is conserved along $\vec{u}$.
Take $\rho(p,\xi)$, so a function of pressure and perhaps something else. Then let's look at how we might put $\rho$ inside the gradient but be equivalent to $\frac{1}{\rho} \vec{\nabla} p$. Consider $f = \int \frac{\textrm{d} p}{\rho(p,\xi)}$, the reason why will become apparent since we want to use the chain rule and fundamental theorem of calculus. Then
$$\vec{\nabla} f(p,\xi) = \frac{\partial f}{\partial p} \vec{\nabla} p + \frac{\partial f}{\partial \xi} \vec{\nabla} \xi = \frac{1}{\rho} \vec{\nabla} p - \int \frac{1}{\rho^2} \frac{\partial \rho}{\partial \xi} \textrm{d}p \vec{\nabla}\xi = \vec{\nabla} \int \frac{\textrm{d} p}{\rho(p,\xi)}.$$
The first step was the chain rule, and the second was the fundamental theorem of calculus to calculate $\partial_p f$. Therefore we either need that $\vec{\nabla}\xi = 0$, or $\partial_\xi \rho = 0$ so that $\vec{\nabla} f = \frac{1}{\rho} \vec{\nabla}p$. Thus either $\xi$ needs to be constant or pressure never depended on $\xi$. Therefore we see this only works for barotropic fluids, which is to equivalently say by definition, $\rho = \rho(p)$.
In conclusion
$$ \vec{u} \cdot \vec{\nabla} \left(\frac{1}{2} \vec{u}^2 + \Psi + \int \frac{\textrm{d}p}{\rho} \right) = 0.$$
A small tid-bit for anyone interested, I mentioned potential flows earlier being able to talk about time dependent flows too. I should note another nice property is that these quantities are not conserved along flow line alone, but over the entire space! The reason we considered along flow lines was the get rid of the pesky curl term, but in potential flows those drop out naturally and we never had need to consider the quantity along a flow line and the result is much more powerful. However, in a time dependent flow they need not necessarily be conserved in time (still more powerful than having to assume time independent flows).