Let's assume that I know $\frac{\partial}{\partial K}f$, where f is scalar valued, and $K$ is a matrix-valued function of $l\in \mathbb{R}$, i.e. $K=K(l)$.
$df=Tr((\frac{\partial}{\partial K}f)^\intercal dK)$, with $dK=\frac{\partial K}{\partial l} dl$.
Can I say that $\frac{d}{dl}f=Tr((\frac{\partial}{\partial K}f)^\intercal \frac{\partial K}{\partial l})$?
Since $dl$ is $1\times 1$, I could take it out of the trace above...
Am I correct?
You are correct.
$$ \frac{df}{dl} = \sum_{i,j} \frac{\partial f}{\partial K_{ij}}\frac{d K_{ij}}{dl} = \sum_{i,j} \left(\frac{\partial f}{\partial K}\right)^T_{ji}\left(\frac{d K}{dl}\right)_{ij} = \sum_{j} \left[\left(\frac{\partial f}{\partial K}\right)^T\frac{d K}{dl}\right]_{jj} =\mathrm{tr}\left[\left(\frac{\partial f}{\partial K}\right)^T\frac{d K}{dl}\right] . $$
See here for the formula $\sum_{ij}X_{ij}Y_{ij}=\mathrm{tr}(X^TY)$.
See also my comments to this other question for a similar but slightly more complex computation.