What network motifs or other mechanisms can make the expression of a gene invariable to the environment?
This phenomenon of being insensitive to certain fluctuations is called robustness. The fluctuations can be of two kinds for an input-output device such as a gene that is activated by a signal:


Fluctuations in the signal
Fluctuations in the intrinsic parameters


Signal fluctuations can be temporal but parameter fluctuations are not (parameters are supposed to be time invariant). Parameter fluctuation can exist in a genotypic space or a population of cells because of variation.

Some motifs are robust to signal perturbations whereas some are robust to parameter fluctuations. 

Negative feedbacks and incoherent feed-forward can confer robustness by correcting the output fluctuations because of fluctuations in the input. 

When an all or none sort of (binary: one state need not be smaller in magnitude than the other) behaviour is important, then positive feedbacks confer robustness to such systems because of their property of bistability. 

I cannot recall any particular motif that is robust to parameters. There are certain cases though (I am still working on that!! :P).

In any case environment can be thought of as an input.  For your question "what mechanisms can make a gene susceptible to a certain environment in one cell-type but not in another":

There can be a heterogeneous population of cells which can arise because of bistability or even otherwise, due to stochastic effects. If the gene that is in one of the two states (expression levels) in these two sub-population of cells, and this gene is responsible for the expression control (the controller gene in feedback), then one sub-population will be sensitive to the environment while the other will not be.

For more information on biological robustness read this review.