Through English grammar books, I understand that a proper preposition is always necessary when the verb in a to-infinitive before a noun is an intransitive verb, such as:
There is no place to play in.
But what about these forms?
A church is not a suitable place to play pop music in.
A church is not a suitable place for playing pop music in.
A church is not a suitable place for playing pop music.
The first and the last form look more natural to me, but I couldn’t find any clues about the differences between the second and the last form in English grammar books or dictionaries. I slightly remember that a Howard Sargeant's book about English preposition contains this content.
Which is grammatically correct between the second and the last form? What are the differences if both are available?
Which is correct?
All of your examples are natural and correct enough, though two arguably are stylistically poor form.
A church is not a suitable place to play pop music in.
A church is not a suitable place for playing pop music in.
A church is not a suitable place for playing pop music.
The minor issue with the first two is that some hold that you should not end a sentence with a preposition. Commenters have pointed out that this is a particularly outdated grammatical 'rule' which has never really been followed anyway. Regardless, I would say the "in" is contextually obvious and therefore not necessary (I've put it in brackets hereafter, since it is optional).
A church is not a suitable place to play pop music (in).
A church is not a suitable place for playing pop music (in).
Where it is not contextually obvious what the preposition should be, you could reorganise the sentence and use a to-infinitive inside a relative clause. This avoids ending the sentence in a preposition (which, as mentioned, isn;t really necessary). You can't use a "for -ing" construction here.
A church is not a suitable place in which to play pop music.
This leaves you with 5 grammatically proper options:
A church is not a suitable place to play pop music (in).
A church is not a suitable place in which to play pop music.
A church is not a suitable place for playing pop music (in).
What are the differences? (Gerunds)
The "-ing" construction is a slightly obscure form of verb called a gerund. Essentially, the gerund is a verb turned into a noun. Often called a nounal-verb. Many verbs have associated nouns and gerunds are rarely used for these verbs, but it's quite trendy these days to use a gerund instead of a noun to emphasise the action-quality. e.g.
The working is hard | The work is hard
Adulting | (no associated noun)
Here, the gerund emphasises that it is the action of working which is hard, rather than the subject of the work. The very modern word "adulting" is a nounal-verb which has no associated noun - a classic use of a gerund.
When the nounal-verb is a subject, either a to-infinitive or a gerund may be used. e.g.
Seeing is believing = To see is to believe
When the nounal-verb plays other roles in sentence construction, you usually should use the gerund form.
To believe is a consequence of seeing
So back to your original examples, the nounal-verb is "to play" or "playing". If we were in a latin classroom, we would call this construction an "objective gerund" - the gerund describes what we ought to do (or not, in this case).
Summary
Analysing our three options in this light:
A church is not a suitable place to play pop music (in).
This is a more colloquial, less rigorous construction which relies on context clues. Essentially this is an acceptable abbreviation of the next option.
A church is not a suitable place in which to play pop music.
This expresses the objective (matter that ought (not) to be done) via a relative clause (in which...) and a to-infinitive.
A church is not a suitable place for playing pop music (in).
This expresses the objective via an objective gerund.