"We are leaving the market now!"
Translation:Tunatoka sokoni sasa!
Because it's being used as a location in the sentence, rather than as a subject or object. Locations can either be represented by locative nouns or prepositional phrases. It can be a destination, static location or origin of motion.
Soko lilianzishwa mwaka mmoja uliopita. The market was started one year ago. (Subject)
Nina(li)penda soko. I like the market. (Object)
Hili ni soko. This is the market. (Complement)
Ninakwenda sokoni. I'm going to the market. (Destination)
Niko sokoni. I'm at the market. (Location)
Ninatoka sokoni. I'm leaving the market. (Source)
The verb -toka isn't transitive. It doesn't take an object ... it takes a location. To say "I left the house", you don't say Nilitoka nyumba but Nilitoka nyumbani or, especially if you're adding adjectives to the house, Nilitoka kwenye/katika nyumba .... For example, to say you're going to the fruit market, you would probably say Ninakwenda kwenye soko la matunda instead of the theoretically correct but, I think, unusual Ninakwenda sokoni kwa matunda.
There seem to be some exceptions to these rules ... for example, I've sometimes seen kwenda shule for kwenda shuleni etc., but that may be because some nouns are kind of "inherently locative", like all place names, and it may be that this inherently locative group of nouns has a kind of flexible, loosely defined membereship that not all speakers agree on.
Also, locations can sometimes be subjects or objects. I think the difference can be illustrated like this.
Soko linapendeza. The market is pleasing/interesting.
Sokoni panapendeza. It's pleasing/interesting at the market.
Ninapenda soko. I like the market.
Ninapapenda sokoni. I like it at the market.
Thanks! I have basically no practical experience of Swahili, but I'm basically just a language nerd. I understand grammar from reading linguistic descriptions of languages and I've been reading quite a bit in Swahili to see how it's actually used (at least how written Swahili works). I was an ESL teacher in Australia for about five years and now I live in Germany and I teach German and also work as an assistant for Deaf people and that involves a lot of language stuff, English, German and German Sign Language (DGS).
The -ni suffix has some restrictions. It can't be used with place names, it's simply not needed there as place names can already be used as locations in the sentence without modification... although if you'd like to make it clear you can use the locative form of a noun like country, city, continent before it (eg. Ninatoka (nchini) Tanzania).
There are also some nouns that simply don't have a -ni form. These are mostly recent borrowings, such as sinema. I'm sure people would understand if you said Ninakwenda sinemani but the correct way to do it would be Ninakwenda kwenye sinema.
Locative nouns are less likely to be used when they have some kind of modifier (adjective, possessive phrase, relative phrase etc.) so, while it might be common to say Nyumbani kwangu "to/at/from my house" (equivalent to kwenye/katika nyumba yangu) it'd be unusual (although theoretically correct) to say Ninakwenda dukani kwa vitabu, and instead you'd say Ninakwenda kwenye duka la vitabu. If you don't say that it's a bookshop but simply a shop, you'd probably just say Ninakwenda dukani because the noun is unmodified.
As for the difference between katika and kwenye, I'm not entirely clear on this but I think they're more or less interchangeable, with katika being a little bit more like "in" ("into", "out of" etc) and kwenye being a bit more general, like "at" ("to", "from" etc).