Pretty possible. But will there be alot of squares in the screen or only one? If it's only one:
you could create the square from four sprites, height set to 10 and width set to 400, and placing them in a square formation. Lets call them wall. Then you create circle object lest call it ball. Give it an instance variable called "hitthewall"
then in the events:
condition:
on sprite collision with another object-wall
subcondition:
if hittewall=0
action:
ball-set instance variable-hitthewall=1
else if
if hittewall=1
action:
gameover.
But if the level has neighbouring or high number of squares it would be tedious to create them one by one by dragging four walls. And neighbouring squares would have two lines of walls so the ball would hit two walls when going from one to another. In that case you should either change the above code to reflect this or find another way.
It may be possible to check if the ball is hittin the edge by comparing positions and sizes.