For Keyboard movement - yes, just make a solid transparent sprite.
For Mouse movement - even with solid sprites, it will not work. But there is a way to make it.
Just edit your ship/player sprite. Click "resize", and now add to the width and height, pixel values of your "walls/UI", Then change "Image" to "align center" so your ship will not be stretched, check "apply to whole animation" and your almost done. Now you have bigger image, but your ship is same size as before, so just "set collision polygon" just for the ship and thats it. That empty space in your sprite will now be working like extra walls, so your ship cant leave that your speciffic area.
If every wall you have has diffrent width/height then just add value of each wall as blank/transparent pixels to your player sprite in photoshop or other program like this.
If you want see how it works, then look at my brickout/arkanoid clone:
https://www.scirra.com/arcade/action-ga ... brick-7787
As you can see there, you move with mouse easly but you cant break thru the laser walls. (these are just simple sprites, not solid)
And here you can see how looks my ship/player sprite. As you can see I have some empty space on both sides of this sprite. This empty space is just as big as my walls, so with behavior "bound to layout" these empty space works like invisible solid walls <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">
PS. Sorry for my english <img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz"> I hope you get the point <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">