The absence of oxygen is absolutely critical for the formation of petroleum products. When oxygen is present, several things can happen.
1)At the surface where the organic material is first laid down ,the presence of oxygen mean the presence of bacteria that can quickly consume the decaying material.
2)It can also lead to the formation of acids and other molecules rather than hydrocarbons.
3)Low levels of oxygen can produce toxic nitrogen oxide compounds.