For "typical" easy office/home environments, calculate with Ta=50 degC. For more demanding, hot climates or any chance the product is used in direct sunlight, calculate with Ta=70 degC. Remember, if you use real ambient (room temperature) in the calculation, your thermal resistance model should include the product casing! If you don't have that, you need to somehow estimate local ambient temperature inside the case.
Then use no more than max Tj=110 degC. For parts rated for higher max Tj (some MOSFETs, SiC diodes, etc.), you can maybe go to 120-130 degC.
The advantage of D2PAK is that the footprint area is massive, allowing large number of thermal vias in pad. You can easily dissipate some 5W through the PCB coupled to a heatsink from the opposite side, using a thermal pad. Even more if you do the job well. If you have more than just one component to cool, this translates into simple and cheap assembly, compared to having to mount (with appropriate electrical isolation) each device to a heatsink separately.
If it is only this one TRIAC, a TO-220 case could be the easiest way out.