Generally speaking, the placement of the prepositional phrase will tell you what role it plays in the sentence.
Adverbial phrases that modify the entire sentence usually go first:
Under the table, the child stroked the cat.
This is more clearly the case for lone introductory adverbs:
Unfortunately, the child was unable to stroke the cat under the table.
Otherwise, immediate proximity counts towards the meaning. To modify "the child," if it's the child who's under the table:
The child under the table stroked the cat.
Perhaps the cat wasn't under the table, but sitting nearby.
To modify "the cat," if it's the cat that's under the table:
The child stroked the cat under the table.
Perhaps the child wasn't under the table but reached to stroke the cat, which was.
It's possible to have a prepositional phrase modify the verb. Here's an adverbial phrase of manner:
The child stroked the cat under the chin.
Notice that the placement of the prepositional phrase is the same in sentences 3 and 4. Moving the phrase in sentence 4 isn't possible: "stroke" wants its object, "the cat," immediately following. You have to rely on the semantics of stroking and chins.