Let's consider the simple divider R1, R2 with two voltage generator connected to it:
https://obrazki.elektroda.pl/9814407200_1369376798.jpg
We want to find Z=V2/I2 that is the impedance seen vy generator V2.
Appling the basic circuit rules we have:
1) I3=I1+I2
2) V2+R1*I1=V1
3) R2*I3=V2
from 2) I1=(V1-V2)/R1
from 3) I3=V2/R2
substituing in 1) we have:
R1*V2=R2*V1-R2*V2+R1*R2*I2
that is:
(R1+R2)*V2-R2*V1=R1*R2*I2
thus:
(R1+R2)/(R1*R2)*V2/I2-V1/(R1*I2)=1
that is:
(R1+R2)/(R1*R2)*Z-V1/(R1*I2)=1
now we have to apply the contribution of each generator considering the same frequency. But when V2 is generating the frequency "f", V1 at that frequency is generating 0 volt (is a DC generator) so V1(f)=0.
(R1+R2)/(R1*R2)*Z=1
then:
Z=R1*R2/(R1+R2)=R1//R2
Then all generator at a different frequency with respect to that of analysis have to be considered short circuits.
In a similar way you can verify that in case of current generators (insteda of voltage generator) you have to consider that generating different frequency that that of analysis as open circuits (i=0)