Niraparib works by inhibiting the activity of the PARP enzyme, which is involved in DNA repair. When PARP is inhibited, cancer cells that are already deficient in other DNA repair mechanisms (such as those with BRCA mutations) become unable to repair their DNA effectively. This leads to the accumulation of DNA damage, ultimately causing cell death.