The array would have been destroyed anyway... except that Voyager instigated a battle with the Kazon that damaged its self-destruct capability. Janeway was simply fulfilling the wishes of an advanced species that Voyager had already interfered with.
The rules concerning the prime directive basically boil down to this:
- Providing knowledge of other inhabited worlds (even if individuals or
governments in the society were already aware of such) to peoples who
had not started using warp technology
- Providing access to advanced technologies or science
- Taking actions to generally affect a society's overall development
- Taking actions which affect the balance of power in a society or region of space
- Helping a society escape the negative consequences of its own actions
- Helping a society escape a natural disaster known to the society,
even if inaction would result in a society's extinction, unless the
society had warp technology and had formally requested aid
- Subverting or avoiding the application of a society's laws
Interfering in the internal affairs of a society
None of these rules were (technically) broken. The reason for this is because they weren't (technically) involving themselves with the Ocampa but with the Caretaker(A Nacene who did meet all the criteria for interference from Starfleet to be allowed). The Caretaker accidently destroyed the ecosystem of the Ocampa homeworld making the nature of their disaster fall outside the reasonings to them not being allowed to help (Seeing it was neither natural or self inflicted).
The Caretaker wanted his station destroyed so it could not fall in to Kazon hands and although this would ultimately be beneficial to the Ocampa, the destruction itself would help a warp capable species fix the problem they caused by not following rules similar to the prime directive.
This isn't the only or first time Starfleet officers bend the rules or interpreted them a bit loosely to make their decisions.
The Prime Directive itself is never fully stated (probably so it would allow for small additions/retcons by the writers). Episodes the prime directive are notably mentioned and explained are:
- The Original Series
- Season 2, episodes 7, 14, 16, 23 and 25
- The Next Generation
- Season 1, episodes 8, 16 and 22
- Season 2, episode 15
- Season 3, episode 4
- Season 4, episodes 7, 15 and 26
- Season 5, episodes 1 and 13
- Season 7, episode 13
- Deep Space Nine
- Season 2, episode 2
- Season 7, episode 16
- Season 1, episodes 2 and 4
- Season 5, episode 9