Let R be a prime ring of characteristic different from 2 and extended centroid C and let f (x 1 , . . . , x n ) be a multilinear polynomial over C not central-valued on R, while δ is a nonzero derivation of R. Suppose that d and g are derivations of R such that δ(d (f (r 1 , . . . , r n ))f (r 1 , . . . , r n ) − f (r 1 , . . . , r n )g(f (r 1 , . . . , r n ))) = 0 for all r 1 , . . . , r n ∈ R. Then d and g are both inner derivations on R and one of the following holds:(1) d = g = 0;(2) d = −g and f (x 1 , . . . , x n ) 2 is central-valued on R.