Why is oxygen the third most abundant element? I was reading the article Oxygen finally spotted in space today in which it stated 

Oxygen is the third most abundant element in the cosmos, after
  hydrogen and helium.

Why would oxygen take the third spot when it is so heavy (relative to the five elements ignored for it)? It would seem logical to me that the third most abundant element would be lithium or beryllium as hydrogen and helium smash into each other.
 A: To be precise, the article mentions molecular oxygen O2 and you are referring to single oxygen, or just simply O. Usually the abundance of any element or molecule is calculated or inferred by how likely it is to be produced in some chemical or nuclear reaction.
If we are talking about just oxygen, then usually it is synthesised at the end of the helium fusion process in massive stars, but in some cases it can be produced earlier, during the neon burning process, which is basically the burning of hydrogen into helium during the CNO cycle. These processes are the third most common processes occurring in stars, and therefore their products are third most abundant. You can read more about this at Wikipedia, in Oxygen and Isotopes of oxygen.
A: The fact that oxygen beats out carbon is explained, for example, in 
a Forbes article by Ethan Siegel: 

But there's one killer move that stars have that makes carbon a loser
  in the cosmic equation: when a star is massive enough to initiate
  carbon fusion -- a requirement for generating a type II supernova --
  the process that turns carbon into oxygen goes almost to full
  completion, creating significantly more oxygen than carbon by time the
  star is ready to explode.

The explanation is needed, because there are more stars (and more total mass in stars) that burn helium to carbon than there are stars massive enough to build oxygen.  
A: Lithium, beryllium and boron aren't produced in (normal) stellar nucleosynthesis - instead, three atoms of helium fuse to form carbon (the triple-alpha process - two helium nuclei fall apart again almost instantly). But the necessary conditions only arise late in the lifetime of a star, when it has stopped burning hydrogen to helium and instead burns helium to heavier elements.
In massive stars there's a catalytic cycle with carbon, nitrogen and oxygen called the CNO cycle, during main sequence evolution - the equilibrium state is very nitrogen rich (which is why massive stars are usually nitrogen overabundent and carbon and oxygen depleted), but in the latter states of the stellar lifetime the balance shifts as helium burning forms carbon - visible in the spectra of carbon-type Wolf-Rayets - while adding a helium nucleus to carbon gives you oxygen. Nitrogen then dips and becomes somewhat underabundent.
Side branches of the CNO cycle are responsible for some other elements, while successively adding helium nuclei to oxygen gives things like silicon, magnesium, calcium (alpha-process elements) and iron. The heavy elements all require neutron capture in red (super)giants.
