If $\rho=\rho(x(t),t)$ and $P=f(\rho)$ is it correct to write:
$\displaystyle\frac{dP}{dt}=f'(\rho) \frac{\partial \rho}{\partial t} +f'(\rho) \frac{\partial \rho}{\partial x} \frac{dx}{dt}$
using the chain rule?
If $\rho=\rho(x(t),t)$ and $P=f(\rho)$ is it correct to write:
$\displaystyle\frac{dP}{dt}=f'(\rho) \frac{\partial \rho}{\partial t} +f'(\rho) \frac{\partial \rho}{\partial x} \frac{dx}{dt}$
using the chain rule?
Yes. That is correct.
You can avoid some confusion by doing it one step at a time: $$ \begin{align} \frac{dP}{dt} &= \frac{dP}{d\rho} \frac{d\rho}{dt}\\ &= \frac{dP}{d\rho}\left(\frac{\partial\rho}{\partial x} \frac{dx}{dt} + \frac{\partial\rho}{\partial t}\frac{dt}{dt}\right)\\ &= \frac{dP}{d\rho}\left(\frac{\partial\rho}{\partial x} \frac{dx}{dt} + \frac{\partial\rho}{\partial t}\right)\\ &= f'(\rho)\left(\frac{\partial\rho}{\partial x} \frac{dx}{dt} + \frac{\partial\rho}{\partial t}\right)\\ &= f'(\rho)\frac{\partial\rho}{\partial x} \frac{dx}{dt} + f'(\rho)\frac{\partial\rho}{\partial t} \end{align} $$
A mnemonic is to draw a tree diagram of the functions, then you have to add together the derivatives along any path that gets to t. At any point where you have multiple choices of what to differentiate against it's a partial $\partial$ and then at any point where there is only one option, it's a "straight" $d$.