Stateing sandstorms post more explicitly.

You hold the A 2

Flop: 7 Q 4

Let us suppose that you are 100% sure that you need at least a flush to win the hand.

You can see 5 cards so there are 52-5 = 47 left in the deck*.
There are 13 diamonds in a 52 cards deck. You can see 4 of them so there must be 9 of them left in the deck. These 9 diamonds are your outs.

The chance that the turn card will be a diamond is simply the number of diamonds / the number of cards left in the deck

9/47 = 0.19 i.e. there is a 19% chance you will make your flush on the turn.

In a hundred trials you can expect to make your flush 19 times on the turn, and not make it 100-19 = 81 times on the turn.
The odds against making a flush on the turn are therefore 81:19 against, which is very close to 4:1 against.


*In fact, your opponent holds 2 cards as well so there are only 45 cards left in the deck. However, since you don't know what your opponents cards are, it is correct to treat the deck as including all of the cards you cannot see (as any of them have an equal probability of being in the deck)