The short answer to your question is very carefully. In the novel Night by Elie Wiesel, to practice your beliefs was dangerous with death the probable punishment. Like everything else, it was easier to maintain customs, culture and beliefs in the ghetto because the Jews were all together in very confined spaces but with fewer eyes watching them. Prayers could be said, marriages celebrated even if there was little food, and the Jewish identity maintained as a relatively cohesive unit. Once they were in the concentration camps, it became infinitely more difficult. Each Jew who was allowed to live had to decide for themselves what they were willing to risk for their beliefs. If they were caught praying or with prayer books, they risked death for themselves plus others who became examples of punishment. Many Jews wondered why the world had abandoned them as others wondered if their God had. Many said the prayers for the dead for themselves on the way to the gas chamber.