Work backwards.
For desired power level and known other parameters you can calculate maximuj allowed ambient.
Rearrange as desired.
1 ... Tambient_max = Tjmax - Power(Rth_ca + Rth_jc)
or
2 ... Power_max = (Tamb-Tjmax) / (Rth_ca + Rth_jc)
or
3 ... Rthca = (Tjmax - Tambmax)/ Power - Rthjc
So (1) - Tambient_max = Tjmax - Power(Rth_ca + Rth_jc) tells you how hot the ambient can be for a given desired Power level, given Rthjc (fixed by manufacturer) and Rthca - set by heatsinking.
eg at P = 10 Watts, Tjmax = 150 c, Rjc = 3 c/W, Rthca = 10 c/W
(1) gives ... Tambient max = 150 - 10W x (3 + 10) = 150 - 130
= 20c :-(.
Change to a 2c / W heatsink and you get
Tambmax = 150 - 10 x (3+2) = 150-50
= 100 c.
ie IF you can get the case within 2c of the water then you can cool it with boiling water :-)
Adjust assumptions to suit.