The main result of the paper is that the Lifshits--Krein trace formula cannot be generalized to the case of functions of noncommuting self-adjoint operators. To prove this, we show that for pairs (A1,B1) and (A2,B2) of bounded self-adjoint operators with trace class differences A2−A1 and B2−B1, it is impossible to estimate the modulus of the trace of the difference f(A2,B2)−f(A1,B1) in terms of the norm of f in the Lipschitz class.