Query Each Database in A Table
Your dynamic SQL has an error.  Try this:

IF COALESCE(OBJECT_ID('dbo.FailingDatabase'), 0) = 0
Create Table [dbo].[FailingDatabase]
(
    DateFailed datetime
    , DatabaseName varchar(1000)
);
TRUNCATE TABLE dbo.FailingDatabase;
Insert INTO [dbo].[FailingDatabase] (DateFailed, DatabaseName)
VALUES ('2016-03-18 08:29:00.000', 'server.database1.dbo.tablename')
    , ('2016-03-18 08:35:00.000', 'server.database2.dbo.tablename');


DECLARE @fullsyntax VARCHAR(MAX);
SET @fullsyntax = '';
;WITH faileddb
AS
(
    SELECT TOP (2) databasename --why you want TOP(2) is unclear
    FROM dbo.FailingDatabase
)
SELECT @fullsyntax = @fullsyntax  
    + CASE WHEN @fullsyntax = '' 
        THEN '' 
        ELSE CHAR(13) + CHAR(10) 
        END
    + 'SELECT datefaield, database FROM ' + [databasename] + ';' 
FROM faileddb
WHERE faileddb.DatabaseName NOT IN (
    'master'
    , 'tempdb'
    );
PRINT (@fullsyntax);