If you did not work in MA then none of your income is taxable in MA. As such, you would not have to file a Massachusetts return.
However, keep in mind that Massachusetts receives the W-2 as well. If they ask questions as to why you chose not to file a Massachusetts nonresident return, you might need to provide documentation that the income was not earned in MA and you did not live in MA.