Basically never.
At least here pyjamas are worn exclusively in private. There is a big overlap of situations where pyjamans are acceptable and those where being naked is acceptable, And the number of situations where you could use pyjamas but should not be naked is roughly as big as the number of situations where naked is fine, but pyjamas are not.