
Foam will need to be covered with something to meet code in this case. You can't leave it exposed.
As far as on the deck, look up above deck venting and radiant barrier technologies.
I have a metal bldg workshop,uninsulated.I want to use 2inch thick styrofoam panels .what is best way to keep them in place I,m in South Carolina,summers are humid do I need air space between panels&metal roof I plan on installing exhaust fans on both ends walls.all advice appreciated. thank you