I would avoid installing any transformer & resistor in an enclosed box or wall.
Where to put it? I guess it depends on the type of transformer you buy. I mean, if it is like this clunky ugly type:
Then you should ‘hide’ it in an place where it isn’t visible (it would look too ugly). If you have a coat closet near your door/doorbell, I’ve typically seen these transformers mounted inside the closet, high up on the wall exposed (to better dissipate heat) and the warm resistor could be mounted with it. Both installed on the inside the closet, exposed to the air on the wall.
But if you get one of these types of transformers that just plugs into a nearby outlet, it isn’t clunky ugly and you could splice in the resistor along side of it (so it remains in the cooler open air).
But, Here are additional links you might find useful:
Instructions with diagrams on how to set up the transformer for a Ring Video Doorbell:
The $10 electrical Resistor (because there is no house chime bell to provide the resistance):
Hope you find this helpful