What's wrong with this "proof" that all Hamiltonians are time independent? The time evolution of a system in classical mechanics is given by the solution of Hamilton's equations of motion, which tell us that
$$\frac{\mathrm{d}p}{\mathrm{d}t}=-\frac{\partial H}{\partial q},\qquad \frac{\mathrm{d}q}{\mathrm{d}t}=\frac{\partial H}{\partial p}.$$
Now, divide the first equation by the second, to obtain $$\frac{\mathrm{d}p}{\mathrm{d}q}=-\frac{\frac{\partial H}{\partial q}}{\frac{\partial H}{\partial p}},$$
and now after a manipulation we arrive at
$$\frac{\partial H}{\partial p}\frac{\mathrm{d}p}{\mathrm{d}q}=-\frac{\partial H}{\partial q},
$$
and multiplying both sides by $\mathrm{d}q$ and doing an addition we arrive at
$$\frac{\partial H}{\partial q}\mathrm{d}q+\frac{\partial H}{\partial p}\mathrm{d}p=0,
$$
which is an exact differential, because of the symmetry of partial derivatives, and we thus must have $\mathrm{d}H=0$. This implies that $H$ is time independent, since it is well known that the total time derivative of the Hamiltonian is equal to its partial time derivative.
This argument obviously is wrong, time-dependent Hamiltonians are obviously allowed. Where's the mistake?
 A: When you divide $dp/dt$ by $dq/dt$ and apply the chain rule to get $\dfrac{dp}{dq}$, you're implicitly assuming that $p$ is a function of $q$ only, thereby assuming time independence of $\mathcal H$.
A: If you call
$$
H(p,q;t) = pq - L(q,\dot q; t)\;,
$$
where $L$ is the Lagrangian, the $p$ is the momentum, and the $q$ is the coordinate, (and the $\dot q$ is a function of the $p$), then you have:
$$
\delta H = \dot q \delta p - \dot p \delta q + \frac{\partial H}{\partial t}\delta t\;.
$$
The above is usually derived starting from the Lagrangian equations of motion and changing variables to eliminate $\dot q$ in favor of $p$.
The above equation for the differential $\delta H$ can also be used to write, by the definition of partial derivative:
$$
\frac{\partial H}{\partial p} = \dot q \qquad (1)
$$
and
$$
\frac{\partial H}{\partial q} = -\dot p  \qquad (2)
$$
If I multiply Equation (1) by $\dot p$ and I multiply Equation (2) by $\dot q$, and I add the equations I get:
$$
\frac{\partial H}{\partial p}\dot p + \frac{\partial H}{\partial q}\dot q = \dot q \dot p - \dot p \dot q = 0\;.
$$
The above equation is similar to what you wrote:

we arrive at $$\frac{\partial H}{\partial q}\mathrm{d}q+\frac{\partial H}{\partial p}\mathrm{d}p=0,$$ which is...

But, there is clearly no implication that $\delta H$ is zero.
So, I think your main error is in stating:

...which is an exact differential, because of the symmetry of partial derivatives, and we thus must have dH=0.


Consider, again, the true expression for $\delta H$:
$$
\delta H = -\dot p \delta q + \dot q \delta p + \frac{\partial H}{\partial t} \delta t\;.
$$
Now suppose you want to "divide both sides by $\delta t$" to see what happens. You find:
$$
\frac{dH}{dt} = -\dot p \dot q + \dot q \dot p + \frac{\partial H}{\partial t}
$$
$$
= \frac{\partial H}{\partial t}\;,
$$
which is what we expect.
A: This was too long for a comment so I'll add it as answer.
You have reformulated that the following holds along a trajectory,
$
dH(p,q,t) = \frac{\partial H}{\partial p}dp +\frac{\partial H}{\partial q}dq + \frac{\partial H}{\partial t}dt \\
dH(p(t), q(t), t)=\frac{\partial H}{\partial p}\frac{dp}{dt}dt +\frac{\partial H}{\partial q}\frac{dq}{dt}dt + \frac{\partial H}{\partial t}dt \\
dH(p(t), q(t), t)=\dot q \dot pdt - \dot p \dot qdt + \frac{\partial H}{\partial t}dt \\
dH(t)=\frac{\partial H}{\partial t}dt \neq 0
$
You can see that differentials in p and q cancel each other along a trajectory that satisfies Hamilton's equations of motion, but the time dependent term remains. You made no statement about that term and thus you cannot conclude that the total differential is zero.
Just showing that some differentials cancel means not that the whole function, does not change.
