Despite advancement in air filtration and recycling technology, many spaceships still keep the practice of manually venting air from unoccupied enclosure within the ship. Such practices had been condemned worldwide due to rising in accidents and fatality reports, heavy fines and lengthy jail terms doesn't seems to be effective in curbing such dangerous practice. I am wondering why would someone attempt to illegally mod a spaceship with air vent?
The same reason why some ships keep illegally washing their tanks in the open sea instead that in the certified facilities: because it's cheaper.
Keeping a working filtering and recycling system for air in space is expensive. Dumping polluted air in space is cheap. And in space there will be nobody complaining about some tar patches killing endangered birds or staining some tourist's foot.
You might be carrying something other than air.
It can be handy to fill a cabin space with chlorine. Cleans and sterilizes well, chlorine does. But you don't want it in your air filter. Or you might fill a space with water, or nickel carbonyl, or helium-4. And you might want to get rid of that stuff later when you could sell it, or you needed an opaque blob in space that sort of looks like a ship, or you needed the room to smuggle a princess.
The air filter / recycler is a temperamental diva with your life in its hands. You want it on a pure air diet. Spaces you sometimes use for moving other gases need a separate mechanism to handle those gases.
Air is heavy.
You don't want to move it if you have a choice. You only want as much as you need to breathe. Unless the fines for venting are less than the cost of moving it, it's a simple calculation, complicated only by the factor that you might not even have to pay the fines.
Air contains evidence
Trace molecules of whatever you were smuggling remain in the air. Venting it removes that, and vacuums up much of what was on the surface.
Indeed, some spaceships use it as the cheapest regular cleaning technique, which means that venting is itself merely evidence toward, not proof of, smuggling.
Air sustains fire and corrosion.
You don't want air around combustibles or things that can be corroded. To be sure, you have to limit it to things not harmed by vacuum, but all safety measures are trade-offs.
One of the most dangerous things in space is fire. You have an enclosed space, likely an oxygen-rich atmosphere, and since there is no gravity, there are no convection currents either so fires will burn hotter. Uncontrolled fire is pretty much the worst possible thing to happen in a spacecraft. So maybe every pressurized compartment comes with a vent that can be used to quickly smother any fire before it becomes an inferno.
The moisture in the vented air condenses into a beautiful crystal cloud. Before reclaiming air from air locks became commonplace, this cloud always coincided with important events of space flight, such as arriving at the destination spaceport. Watching it from the windows was a very common way to celebrate a successful flight.
Just like shooting into air on Earth, old habits die hard. Government spaceports now monitor for ships puffing clouds, but outer space is still a wild place. Some passengers just won't feel like the trip is complete without the crystal cloud, and the ship owners want their passengers to be happy.
If you are left-wing, then EvilCorp has somehow secured a perpetual (or practically perpetual) patent on air recycling systems. If you are right-wing, then the Air Recycling Technicians' Union has an absolute monopoly on all servicing and repair of ships' systems. If you're just cynical, then it's both and they are working together.
Via their initial control of such a necessary resource at a crucial moment in the past, this monopolist has exerted significant political power to ensure that patent-busting or union-busting legislation cannot affect their stranglehold (in fact the reverse: over time they have strengthened property/labour laws to suit themselves). Furthermore, they have leveraged their position in ship maintenance/supply to become an organised crime syndicate / de facto local government in space facilities.
All that guff about the so-called danger of venting air into space is vastly exaggerated. Very few people are aware, but many of the "accidental fatalities" were in fact the mob disposing of their opponents and blaming it on illegal venting. Nobody has run the stats, but it's astonishing the proportion of victims of those accidents who happened to be technicians capable of building and maintaining an unsanctioned scrubber. But somehow it seems to be the non-fatal ventings where the law comes down like a tonne of pre-fabricated construction material units.
The real reason it is so illegal, is that loading your ship up on bottled air and venting as you go would allow people to avoid their exorbitant monopoly. The reason people do it anyway, despite the absurd inefficiency of venting an otherwise perfectly-good atmosphere when it hits 0.2% CO2 (0.5% if you don't mind feeling physically ill much of the time), is that fixing a broken recycling system doesn't just run up a massive bill, it exposes you to contact with the mob that you'd rather avoid. Especially if the problem hits when you're away from your home port, where at least you'd personally know the mobster you're dealing with.
OK, a political situation this abusive is probably unstable long-term. So, enter the plot.
In your spacecraft, the energy cost might be a major factor... it certainly is on real spacecraft. This is closely related to L.Dutch - Reinstate Monica's answer, but where "cheap" refers to energy costs, rather than monetary.
I would imagine that the most likely culprits to illegally vent air are also those that are under the most compelling financial incentive to do so. In other words: those without much money and looking to save it through any means.
How do you save money in a pinch? Strip the fully-rated power system out of your ship, sell the parts, and jury-rig a minimal power system in its place. That power system might only have just enough power to get your ship from point A to point B without drawing too much attention.
The ship's air circulation systems and filtration systems put additional strain on those power systems. If you don't need to preserve all the air for your trip, it would take much less energy to simply let the air passively settle under artificial gravity (like in a rotating ring), then vent the heavier gasses (like carbon dioxide). Now you have *almost free air filtration! Of course, this isn't perfect or precise, so you'll still lose some oxygen and nitrogen along with the waste gas, but you have plenty to spare, right? And it's pretty unlikely that the valve would get stuck open... nothing could go wrong.
Moreover, using less energy also means using less fuel to produce said energy. Less fuel is less money, so you've just compounded your savings!
Now that you're using passive filtration, you can downgrade your ship's filtration system too, and recoup even more money!
* Note that you'll still need to expend some energy to recover the loss due to conservation of angular momentum, but that's pretty minimal.
If you need to reduce the air pressure in the spacecraft it costs less energy to vent than to use a condenser and oxygen concentrator to try and stuff oxygen into a pressurized tank. Assuming you have a low cost or free way of generating oxygen which you probably would (given advances in generating oxygen that we already know of)
Maybe it's a reclaimed junk ship that they only use for short hauls. Air filtration and recycling system sound delicate and expensive to repair/replace and maintain. In a reclaimed junk ship that's already ratty, that you only meant to use for short trips those systems might not be strictly necessary.
You are in a profession where occasionally people get on to your ship with bad intentions. Maybe they are boarders after your trade goods or tax inspectors asking too many questions while you are smuggling. What easier way to get rid of them than to use a central computer control system or door control to eject them into space?
Since it will be difficult to trick unwanted visitors into stepping into an airlock you will usually lose a roomful of air whenever you use this last ditch strategy.