Polymeric carbon nitride (p-C3N4) is a promising platform as a metal-free photo-catalyst for various reactions. The p-C3N4 can be produced by thermal poly-condensation of organic precursors. Their morphological and chemical structures depend on reaction conditions during the poly-condensation. In this study, two p-C3N4 materials are produced by heat treatment of urea under different gaseous conditions with air (urea-derived carbon nitride under air, UCN-A) and N2 (UCN-N), respectively. UCN-A and UCN-N samples are mesoporous materials and show excellent photocatalytic activities for degrading rhodamine B, an organic pollutant, under the irradiation of visible light. The UCN-A shows the better photocatalytic activity than UCN-N. Various characterizations reveal that more porous structures and larger surface areas of UCN-A are reasons for the better photocatalytic performance.