Can published messages be stored encrypted in the PubNub database?

Yes, but encryption is up to the client. Messages encrypted when published will be encrypted when stored and must be decrypted when retrieved.