Let $ A = \mathbf{R}[M_n(\mathbf{R})]$ be the ring of polynomials in the real $n$ by $n$ matrices (which nothing more than the polynomial ring in $n^2$ variables).
We say that $P \in A$ is invariant (by conjugation) if $P(gMg^{-1}) = P(M)$ for every $M \in M_n(\mathbf{R})$ and $g \in \text{GL}_n(\mathbf{R})$.
My question : Does there exist $P \neq 0 \in A$ which is invariant and such that $P(D) = 0$ for any diagonal matrix $D \in M_n(\mathbf{R})$.
Motivation : Over $\mathbf{C}$ this is not possible because the diagonalizable matrices are dense in $M_n(\mathbf{C})$ and thus an invariant polynomial which cancels all diagonal matrices will be be zero on a dense subset and thus zero everywhere.
Over $\mathbf{R}$ the closure of the set of diagonalizable matrices is the set of triangularizable matrices thus my question can be reformulated as : does there exist a non zero invariant polynomial over $\mathbf{R}$ which is zero on all triangularizable matrices but not zero ?
Edit : One idea I have to prove this would be to go to $\mathbf{C}$. Since $\mathbf{R}$ is infinite we get that if $P$ is an invariant polynomial in $\mathbf{R}[M_n(\mathbf{R})]$ which is zero on all diagonal matrices we can see it as a polynomial in $\mathbf{C}[M_n(\mathbf{C})]$ which is zero on all diagonal matrices. What is not clear to me is : is it invariant by conjugation by $\text{GL}_n(\mathbf{C})$? If is was so we would be done of course since $P$ would be zero in $\mathbf{C}[M_n(\mathbf{C})]$.