As already pointed out in the other answers, a blind creature can still attack, only it will be at disadvantage. That much is set in stone. But I don't think your main concern is on the mechanics of blind-fighting, so I'll add to "how to decide where to attack".
In the case you presented, you want to know how the goblin would decide which square to attack, since he knew a foe was within 5ft. But first you should clarify if, before being blinded, (1) the goblin knew precisely where the foe was or (2) it had a general idea that the foe was somewhere within 5ft. From your question, that remains unclear.
If (1), then, in its next round, the goblin would attack the square where the foe was last seen. Blind-fighting rules applied, if the goblin still managed to hit something it considered a foe, then it would keep attacking that square until it misses.
In case (2) or after missing in case (1), the goblin would blindly pick a square within 5ft to attack. If it ever hits a foe, it would keep attacking that square until it misses, otherwise it would blindly pick another square and so on.
To simulate the blind pick, you just assign numbers from 1-8 to a 3x3 grid, centered on the goblin (see below), then roll a d8 and attack the corresponding spot. However, if the goblin has just attacked a spot and missed, it would try its luck on the next attack on a different spot, so you eliminate the previous spot by rerolling the d8 if you get the last number again.
1 2 3
8 g 4 --> g = goblin
7 6 5
Roll a d8. Say you got 5, so you attack that square. If it's a miss, roll a d8 for the next attack. If you get another 5, which is the spot the goblin just missed and assumed nothing was there, reroll the d8 until you get another number. Say you got 2 and managed to score a hit. Next attack you won't roll a d8, the goblin would simply attack 2 again, until it misses. Repeat while the blindness lasts.
Note: both attacking and defending creatures' size and the attacker's reach impact the grid. Make sure you account for that in different scenarios.
Of course, you can adjust that to your needs. For instance, if the goblin knew a foe was somewhere 5ft behind it, you can determine the front and back of the goblin and then only assign numbers to the 3 squares behind it and roll a d3.