When asked to replace P1^2+P2^2+P3^2 by P, GiNaC (symbolics back-end for Sage) looks for an exact match. If this sum is part of an expression, such as P1^2 + P2^2 + P3^2 + sqrt(P)*P0 there will be no substitution.
sage: denominator.substitute({P1^2: P- P2^2 - P3^2})