The Original Poster's example is:
- I wonder if I should go visit the people I left so suddenly in that one town I never knew of*?
Although the sentence is perfectly grammatical, a more natural wording for a native speaker might be something like:
- Should I go and visit the people I left in that town I never knew the name of?
The Original Poster's question is actually about when the object of a verb + preposition combination must follow the verb + preposition, and when it can be separated from it. Notice that in the Original Poster's example, the apparent object of the verb and preposition combination precedes the verb:
- ...a town I never knew of.
Let's have a look at the structure of the verb phrase in a normal subordinate clause:
- I said that I never knew of that town.
Here the verb knew takes as it's complement a Preposition Phrase headed by the preposition of. In other words the complement of knew is the phrase of that town:
Within the Preposition Phrase itself, the preposition of is taking the Noun Phrase that town as its own complement.
The reason that a town precedes I never knew of in the Original Poster's example is that a town is not the object of the preposition of here. Neither is it functioning as an object of a verb plus preposition combination. Quite the reverse in fact. The string a town I never knew of is actually a Noun Phrase.
The phrase is, more specifically, a noun modified by a relative clause. A fuller version of the phrase could be either of the following:
- a town which I never knew the name of.
- a town that I never knew the name of.
Here the relative clause which I never knew of is modifying the noun town. The structure of the phrase could be represented thus:
- [a] [town which I never knew of].
The relative clause is fronted by the relative pronoun which. Which is actually the object of the preposition of. Because it is functioning as a relative pronoun it moves to the front of the clause. However because which is not a subject in the clause, but, in this case, the object of a preposition, we are allowed to omit it from the sentence, as in the OP's example.
Old fashioned prescriptive grammarians might once have argued that leaving the preposition stranded at the end of the sentence like this without a following object was ungrammatical. They might have given the following as a better version of the phrase:
- a town of which I never knew.
In this type of construction, the whole preposition phrase moves to the front of the sentence. This means that the preposition appears before its object as in a normal sentence. Whilst this is perfectly grammatical, it is of course complete nonsense that we cannot leave the preposition stranded at the end of the clause, and most good writers do so, often. Especially in the OP's rather informal sentence, it is far better style to leaver the preposition at the end of the relative clause than move it to the front. One important reason why is that it allows the pronoun which to be dropped from the sentence, which in informal speech and writing is usually preferable. This is not possible if the preposition is fronted:
- a town of I never knew. * (wrong)
The other reason is that both the versions with which and that read very clunkily. The stranded preposition version is by far the least offensive to ones natural ear.
The alternative example
The same sort of principles would apply to:
- a town I never knew the name of.
Only, here, the structure of the original verb phrase is quite different. A canonical version of the clause would be:
- I never knew the name of that town.
In this example the verb knew is taking as it's direct object the Noun Phrase the name of that town. This is a genitive construction where the noun name is modified by the Preposition Phrase of that town. This Preposition Phrase consists of the preposition 'of and its complement that town. Again, in a relative clause, the element which representing town in the clause would be omissible. This time, one option would be to move the whole NP containing the source of the relative word to the front of the clause:
- that town the name of which I never knew.
Alternatively, we could use the relative pronoun whose in a similar construction:
- that town whose name I never knew.
As in the OP's original example, the versions without which or that and also without whose are infinitely better.
In short, when the object of a preposition is relativised and moves to the front of a relative clause, it is perfectly acceptable to leave the preposition at the end of the clause. In normal sentences however, the object of the preposition usually appears directly after it.
Hope this helps