Can p-trap be installed inside wall?
As far as the international plumbing code is concerned (relevant section is here), you're fine putting it pretty much anywhere that meets the distance requirements. In fact, the only mention of accessibility is in mental health facilities where traps are required to be inaccessible.  This is really no different than pouring concrete over the trap in a floor drain - just make sure it gets noted during the rough-in inspection.