I was browsing through the Pathfinder questions on site an came across this little nugget among them. Inspired by this attempt at the mythical unusual, I began to study the different spells in the Core Rulebook to discover the most efficient means of NPCs selling mass quantities of mythical meat in a campaign. The most hygienic and air-tight method that I could find was casting Stone to Flesh on a bolder created through Polymorph any Object on pure water. Of course a HUGE part of this working depends on how long the transformation lasts for PaO. Considering the length of PaO depends on the similarity of the objects, and the chart lacks certain details in the Kingdom section, does a water to rock transformation last forever, or only for 3 hours?
Having previously asked a question on the limitations of polymorph any object myself, I feel quite confident in saying it would last forever.
A huge rock is undoubtedly part of the mineral kingdom; Whether water is a mineral is a little more debatable, but assuming it's as pure as you say, it's definitely not animal or vegetable. That gets us the Same Kingdom bonus of +5. The two objects are certainly not the Same Class, and not really Related, but it's trivial to make it the Same Size for another +2. Finally, while water is arguably slightly more intelligent than rock, I'd argue the difference is small enough to not show up at the granularity of ability scores used by D&D, so we can easily claim the +2 Same or Lower Intelligence bonus.
Adding all those up, we have a nice +9, for a Permanent duration.
That said, I should point out two things. First, for your use-case, the water doesn't need to be pure. You're not transmuting the "element of the water" in your starting object into the "element of stone"; You're polymorphing "a barrel of water" into "a barrel-sized rock." You could similarly use Polymorph Any Object to turn "a corpse filled with daggers" into "a pure spherical crystal" and the resulting object would be entirely dagger-free. Impurities in the starting object don't have to be present in the end product if you don't want them to be; You can just choose to turn unclean water into "a rock that is pure and free of contaminants."
Second, there's some controversy and debate about what happens when you cast a spell to change an object into something else on a target that's already the subject of such a spell, and polymorph any object is at the centre of that controversy. Its description says "The duration of the spell depends on how radical a change is made from the original state to its transmuted state," but it's not really clear whether the "original" state of the target should include changes made by previous polymorph spells. If you turn a tree into a rock, and then cast polymorph any object again to turn the rock into an identical rock, how long does the spell last? Being able to make any polymorph any object spell permanent just by casting it twice seems like it might not be what the designers intended - and indeed, the section on the "polymorph" subschool does say "You can only be affected by one polymorph spell at a time."
On the other hand, stone to flesh isn't a polymorph spell even if it feels like one, and almost the entire polymorph section is written as if polymorph spells always target the caster and not inanimate objects, so it's still a little ambiguous what happens when you try to turn a rock-that-was-once-water into meat.
Complicating this further is the fact that a permanent-duration spell isn't the same thing as an instantaneous-duration one. Even if you make the polymorph any object spell permanent, the spell is still there, actively maintaining the target's new form, and can be detected and interacted with by any effects that can interact with active spells. What happens if the polymorph any object spell that makes the water into rock is dispelled after the stone to flesh spell is has already been cast? Does the stone to flesh spell end due to no longer having a valid target? But stone to flesh is instantaneous in duration, and the target was valid at the time of casting, so... What should happen, here?
In any case, polymorph any object is arguably the ultimate polymorph spell: It can change almost anything into anything and do things that no other option in the rules can achieve, such as turning something that lacks a soul into something that has one. Many GMs will have different ideas about what it should and shouldn't be able to do and what the consequences of layering it with other spells should be, so I suspect you'll have to ask yours for a ruling.
Thanks to the dark wanderer for the background on Linnaean taxonomy.