Assume you have the board
....o.
......
....o.
o.....
...o..
......
and suppose your starting position is (row, col) = (1,1).
At (1,1) there is no obstacle, hence you may occupy it and set area = 1:
....o.
.x....
....o.
o.....
...o..
......
Now try to expand your square in the left-down direction. since (1,2), (2,2), (2,1) don't contain obstacles. occupy them
....o.
.xx...
.xx.o.
o.....
...o..
......
and set yor area = 4.
Going on, you may find that (1,3), (2,3), (3,3), (3,2), (3,1) don't contain any obstacle. Occupy them:
....o.
.xxx..
.xxxo.
oxxx..
...o..
......
and set area = 9
Now, trying to continue, you find the first obstacle, at (3,4), so you have to stop and say that max area, for top-left square starting from (1,1) is
9
.
Iterating such process starting from all the square of the board (keeping track of the max area found) gives you a brute force approach (that can be easily optimized).